Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader,
|
| 2 |
from llama_index.llms.openai import OpenAI
|
| 3 |
from huggingface_hub import snapshot_download
|
| 4 |
import gradio as gr
|
|
@@ -73,11 +73,11 @@ gerar_arquivo_documentacao(docs_dir)
|
|
| 73 |
documents = SimpleDirectoryReader(input_files=["documentacao.txt"]).load_data()
|
| 74 |
|
| 75 |
|
|
|
|
|
|
|
|
|
|
| 76 |
# 🔎 Criar o índice vetorial
|
| 77 |
-
|
| 78 |
-
llm=OpenAI(model="gpt-3.5-turbo")
|
| 79 |
-
)
|
| 80 |
-
index = VectorStoreIndex.from_documents(documents, service_context=service_context)
|
| 81 |
|
| 82 |
|
| 83 |
# 🚀 Criar engine de consulta
|
|
|
|
| 1 |
+
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader, Settings
|
| 2 |
from llama_index.llms.openai import OpenAI
|
| 3 |
from huggingface_hub import snapshot_download
|
| 4 |
import gradio as gr
|
|
|
|
| 73 |
documents = SimpleDirectoryReader(input_files=["documentacao.txt"]).load_data()
|
| 74 |
|
| 75 |
|
| 76 |
+
# 🧠 ✅ Definir o LLM (agora com Settings no lugar de ServiceContext)
|
| 77 |
+
Settings.llm = OpenAI(model="gpt-3.5-turbo")
|
| 78 |
+
|
| 79 |
# 🔎 Criar o índice vetorial
|
| 80 |
+
index = VectorStoreIndex.from_documents(documents)
|
|
|
|
|
|
|
|
|
|
| 81 |
|
| 82 |
|
| 83 |
# 🚀 Criar engine de consulta
|