Skip to content
Snippets Groups Projects
Unverified Commit fadef5f3 authored by Sam Tsao's avatar Sam Tsao Committed by GitHub
Browse files

Make ollama support additional_kwargs correctly (#9455)

make ollama_additional_kwargs working
parent 55222b5d
No related branches found
No related tags found
No related merge requests found
...@@ -83,7 +83,7 @@ class OllamaEmbedding(BaseEmbedding): ...@@ -83,7 +83,7 @@ class OllamaEmbedding(BaseEmbedding):
ollama_request_body = { ollama_request_body = {
"prompt": prompt, "prompt": prompt,
"model": self.model_name, "model": self.model_name,
**self.ollama_additional_kwargs, "options": self.ollama_additional_kwargs,
} }
response = requests.post( response = requests.post(
......
...@@ -63,7 +63,7 @@ class Ollama(CustomLLM): ...@@ -63,7 +63,7 @@ class Ollama(CustomLLM):
def _model_kwargs(self) -> Dict[str, Any]: def _model_kwargs(self) -> Dict[str, Any]:
base_kwargs = { base_kwargs = {
"temperature": self.temperature, "temperature": self.temperature,
"max_length": self.context_window, "num_ctx": self.context_window,
} }
return { return {
**base_kwargs, **base_kwargs,
...@@ -117,7 +117,7 @@ class Ollama(CustomLLM): ...@@ -117,7 +117,7 @@ class Ollama(CustomLLM):
response = requests.post( response = requests.post(
url=f"{self.base_url}/api/generate/", url=f"{self.base_url}/api/generate/",
headers={"Content-Type": "application/json"}, headers={"Content-Type": "application/json"},
json={"prompt": prompt, "model": self.model, **all_kwargs}, json={"prompt": prompt, "model": self.model, "options": all_kwargs},
stream=True, stream=True,
) )
response.encoding = "utf-8" response.encoding = "utf-8"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment