Skip to content

Commit

Permalink
Merge pull request #459 from kreneskyp/function_call_linting
Browse files Browse the repository at this point in the history
empty function_call prop passed to IxChatOpenAI is now ignored
  • Loading branch information
kreneskyp committed Feb 24, 2024
2 parents 0971c15 + eb9a9ea commit 2470762
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions ix/runnable/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@ def bind(self, **kwargs: Any) -> Runnable[Input, Output]:
"""
kwargs = kwargs.copy()

if "function_call" in kwargs:
if isinstance(kwargs["function_call"], str):
kwargs["function_call"] = {"name": kwargs["function_call"]}
function_call = kwargs.pop("function_call", None)
if function_call:
if isinstance(function_call, str):
kwargs["function_call"] = {"name": function_call}
else:
kwargs["function_call"] = function_call

if "functions" in kwargs:
kwargs["functions"] = [to_openai_fn(obj) for obj in kwargs["functions"]]
Expand Down

0 comments on commit 2470762

Please sign in to comment.