mirror of https://github.com/aliasrobotics/cai.git
Merge branch 'ollama_no_stream' into '0.4.0'
Fix ollama models See merge request aliasrobotics/alias_research/cai!205
This commit is contained in:
commit
d9abd4636c
|
|
@ -2548,7 +2548,6 @@ class OpenAIChatCompletionsModel(Model):
|
|||
tool_choice: ChatCompletionToolChoiceOptionParam | NotGiven,
|
||||
stream: bool,
|
||||
parallel_tool_calls: bool,
|
||||
provider="ollama"
|
||||
) -> ChatCompletion | tuple[Response, AsyncStream[ChatCompletionChunk]]:
|
||||
"""
|
||||
Fetches a response from an Ollama or Qwen model using LiteLLM, ensuring
|
||||
|
|
@ -2561,7 +2560,6 @@ class OpenAIChatCompletionsModel(Model):
|
|||
tool_choice (ChatCompletionToolChoiceOptionParam | NotGiven): Tool choice.
|
||||
stream (bool): Whether to stream the response.
|
||||
parallel_tool_calls (bool): Whether to allow parallel tool calls.
|
||||
provider (str): Provider name, defaults to "ollama".
|
||||
|
||||
Returns:
|
||||
ChatCompletion or tuple[Response, AsyncStream[ChatCompletionChunk]]:
|
||||
|
|
@ -2601,8 +2599,6 @@ class OpenAIChatCompletionsModel(Model):
|
|||
model_str = str(self.model).lower()
|
||||
is_qwen = "qwen" in model_str
|
||||
api_base = get_ollama_api_base()
|
||||
if "ollama" in provider:
|
||||
api_base = api_base.rstrip('/v1')
|
||||
|
||||
if stream:
|
||||
response = Response(
|
||||
|
|
@ -2623,7 +2619,7 @@ class OpenAIChatCompletionsModel(Model):
|
|||
stream_obj = await litellm.acompletion(
|
||||
**ollama_kwargs,
|
||||
api_base=api_base,
|
||||
custom_llm_provider=provider,
|
||||
custom_llm_provider="openai"
|
||||
)
|
||||
return response, stream_obj
|
||||
else:
|
||||
|
|
@ -2631,7 +2627,7 @@ class OpenAIChatCompletionsModel(Model):
|
|||
return litellm.completion(
|
||||
**ollama_kwargs,
|
||||
api_base=api_base,
|
||||
custom_llm_provider=provider,
|
||||
custom_llm_provider="openai",
|
||||
)
|
||||
|
||||
def _intermediate_logs(self):
|
||||
|
|
|
|||
Loading…
Reference in New Issue