Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix:error when adding the ollama embedding model (#8236)

HowardChan82c42b9ec5fd
diff --git a/api/core/model_runtime/model_providers/ollama/text_embedding/text_embedding.py b/api/core/model_runtime/model_providers/ollama/text_embedding/text_embedding.py
index 60b85197be6..ffa9ea2f907 100644
--- a/api/core/model_runtime/model_providers/ollama/text_embedding/text_embedding.py
+++ b/api/core/model_runtime/model_providers/ollama/text_embedding/text_embedding.py
@@ -77,15 +77,10 @@ class OllamaEmbeddingModel(TextEmbeddingModel):
inputs.append(text)
# Prepare the payload for the request
- payload = {
- "input": inputs,
- "model": model,
- }
+ payload = {"input": inputs, "model": model, "options": {"use_mmap": "true"}}
- # Make the request to the OpenAI API
- response = requests.post(
- endpoint_url, headers=headers, data=json.dumps(payload), timeout=(10, 300), options={"use_mmap": "true"}
- )
+ # Make the request to the Ollama API
+ response = requests.post(endpoint_url, headers=headers, data=json.dumps(payload), timeout=(10, 300))
response.raise_for_status() # Raise an exception for HTTP errors
response_data = response.json()