Skip to content

Commit

Permalink
fix: data type issue with the write_tool
Browse files Browse the repository at this point in the history
  • Loading branch information
sshivaditya committed Jan 9, 2025
1 parent ca8b2e0 commit 3002329
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/adapters/openai/helpers/completions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,12 @@ export class Completions extends SuperOpenAi {

try {
const toolRequest: ToolRequest = JSON.parse(toolJson);

// For writeFile, ensure content is stringified if it's an object
if (toolRequest.tool === "writeFile" && toolRequest.args.content && typeof toolRequest.args.content === "object") {
toolRequest.args.content = JSON.stringify(toolRequest.args.content, null, 2);
}

const result = await this._executeToolRequest(toolRequest, workingDir);

// Replace this specific tool block with its result
Expand Down

0 comments on commit 3002329

Please sign in to comment.