MCPcopy Create free account
hub / github.com/Azure-Samples/llama-index-python / init_ollama

Function init_ollama

backend/app/settings.py:30–44  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

28
29
30def init_ollama():
31 from llama_index.llms.ollama.base import Ollama, DEFAULT_REQUEST_TIMEOUT
32 from llama_index.embeddings.ollama import OllamaEmbedding
33
34 base_url = os.getenv("OLLAMA_BASE_URL") or "http://127.0.0.1:11434"
35 request_timeout = float(
36 os.getenv("OLLAMA_REQUEST_TIMEOUT", DEFAULT_REQUEST_TIMEOUT)
37 )
38 Settings.embed_model = OllamaEmbedding(
39 base_url=base_url,
40 model_name=os.getenv("EMBEDDING_MODEL"),
41 )
42 Settings.llm = Ollama(
43 base_url=base_url, model=os.getenv("MODEL"), request_timeout=request_timeout
44 )
45
46
47def init_openai():

Callers 1

init_settingsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected