Skip to content

Commit

Permalink
Process review comments:
Browse files Browse the repository at this point in the history
- Prevent crash when user has empty functions directory
- Prevent parallel function calling from the LLM as we don't handle that correctly
- The option to disable parallel function calling is added in a later release of the openai library, so upgraded it
  • Loading branch information
tijszwinkels committed Jun 12, 2024
1 parent fe88db6 commit db61625
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ classifiers = [
"Programming Language :: Python :: 3.11",
]
dependencies = [
"openai >= 1.6.1, < 2.0.0",
"openai >= 1.34.0, < 2.0.0",
"typer >= 0.7.0, < 1.0.0",
"click >= 7.1.1, < 9.0.0",
"rich >= 13.1.0, < 14.0.0",
Expand Down
7 changes: 5 additions & 2 deletions sgpt/handlers/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,16 @@ def get_completion(
if is_shell_role or is_code_role or is_dsc_shell_role:
functions = None

if functions:
additional_kwargs["tool_choice"] = "auto"
additional_kwargs["tools"] = functions
additional_kwargs["parallel_tool_calls"] = False

response = completion(
model=model,
temperature=temperature,
top_p=top_p,
messages=messages,
tools=functions,
tool_choice="auto",
stream=True,
**additional_kwargs,
)
Expand Down

0 comments on commit db61625

Please sign in to comment.