fix(ollama_chat.py): accept api key as a param for ollama calls

allows user to call hosted ollama endpoint using bearer token for auth
This commit is contained in:
Krrish Dholakia 2024-04-19 13:01:52 -07:00
parent b2bdc99474
commit 3c6b6355c7
4 changed files with 63 additions and 21 deletions

View file

@ -1941,9 +1941,16 @@ def completion(
or "http://localhost:11434"
)
api_key = (
api_key
or litellm.ollama_key
or os.environ.get("OLLAMA_API_KEY")
or litellm.api_key
)
## LOGGING
generator = ollama_chat.get_ollama_response(
api_base,
api_key,
model,
messages,
optional_params,