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

Co-authored-by: crazywoola <427733928@qq.com>
This commit is contained in:
HowardChan 2024-09-11 10:25:45 +08:00 committed by GitHub
parent 2a3d8c25bc
commit 82c42b9ec5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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()