mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 10:44:24 +00:00
Refactor logic
This commit is contained in:
parent
a2b836b6a4
commit
f517e5953a
1 changed files with 2 additions and 6 deletions
|
@ -3010,14 +3010,10 @@ def get_optional_params( # noqa: PLR0915
|
|||
if custom_llm_provider == "ollama":
|
||||
optional_params["format"] = "json"
|
||||
litellm.add_function_to_prompt = True # so that main.py adds the function call to the prompt
|
||||
non_default_params.pop("tool_choice", None) # causes ollama requests to hang
|
||||
|
||||
if "tools" in non_default_params:
|
||||
optional_params[functions_unsupported_model_key] = non_default_params.pop("tools")
|
||||
non_default_params.pop("tool_choice", None) # causes ollama requests to hang
|
||||
elif "functions" in non_default_params:
|
||||
optional_params[functions_unsupported_model_key] = non_default_params.pop("functions")
|
||||
# Handle all other providers that are not OpenAI-compatible
|
||||
elif litellm.add_function_to_prompt and (custom_llm_provider not in litellm.openai_compatible_providers):
|
||||
if litellm.add_function_to_prompt and (custom_llm_provider not in litellm.openai_compatible_providers):
|
||||
# Attempt to add the supplied function call to the prompt, preferring tools > functions > function_call
|
||||
function_call_value = non_default_params.pop("tools",
|
||||
non_default_params.pop("functions",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue