Код: Выделить всё
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader, Settings
from llama_index.embeddings.huggingface import HuggingFaceEmbedding
from llama_index.llms.ollama import Ollama
documents = SimpleDirectoryReader("C:path/example/data").load_data()
# Using bge-base embedding model
Settings.embed_model = HuggingFaceEmbedding(model_name="BAAI/bge-base-en-v1.5")
# Setting up Ollama LLM with a timeout of 1 hour
Settings.llm = Ollama(model="llama3", request_timeout=3600.0)
index = VectorStoreIndex.from_documents(documents)
query_engine = index.as_query_engine()
response = query_engine.query("What did the author do growing up?")
print(response)
Уменьшение request_timeout для ускорения запрос, но в результате возникает ошибка ReadTimeout
Код: Выделить всё
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader, Settings
from llama_index.embeddings.huggingface import HuggingFaceEmbedding
from llama_index.llms.ollama import Ollama
documents = SimpleDirectoryReader("C:path/example/data").load_data()
# Using bge-base embedding model
Settings.embed_model = HuggingFaceEmbedding(model_name="BAAI/bge-base-en-v1.5")
# Setting up Ollama LLM with a timeout of 1 hour
Settings.llm = Ollama(model="llama3", request_timeout=60.0)
index = VectorStoreIndex.from_documents(documents)
query_engine = index.as_query_engine()
response = query_engine.query("What did the author do growing up?")
print(response)
Подробнее здесь: https://stackoverflow.com/questions/791 ... l-in-jupyt
Мобильная версия