Skip to content

Commit

Permalink
Merge pull request #4 from zerodays/feat/use-chat-hook
Browse files Browse the repository at this point in the history
fix: add tools to call only if any are present
  • Loading branch information
horvatz authored Apr 8, 2024
2 parents 523b233 + 06fb624 commit 52fa07c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/openai/chat-completion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,11 @@ export class ChatCompletion {

// Serializes all the parameters to JSON for calling the API
serializeParams() {
const tools = toolsToJsonSchema(this.params.tools ?? {});
if (this.params.tools == null) {
return JSON.stringify(this.params);
}

const tools = toolsToJsonSchema(this.params.tools ?? {});
return JSON.stringify({
...this.params,
tools,
Expand Down

0 comments on commit 52fa07c

Please sign in to comment.