@devries-cameron20 / composio Mirror · read-only / commits / 1f363e42e
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 23, 04:15 UTC

Clean up request execution

haxzie committed Apr 17, 2025 at 11:56 UTC 1f363e42e4887b6432258fff5501caf30e96d3cd
2 files changed +12 -6
examples/openai/src/index.ts
+7 -2
@@ -33,6 +33,11 @@ const response = await openai.chat.completions.create({
33
34
35 if (response.choices[0].message.tool_calls) {
36 - const result = await composio.toolset.executeToolCall(response.choices[0].message.tool_calls[0]);
37 - console.log(JSON.stringify(result, null, 2));
36 + try {
37 +
38 + const result = await composio.toolset.executeToolCall(response.choices[0].message.tool_calls[0]);
39 + console.log(JSON.stringify(result, null, 2));
40 + } catch (error) {
41 + console.error(JSON.stringify(error, null, 2));
42 + }
43 }
\ No newline at end of file
packages/toolsets/openai/src/index.ts
+5 -4
@@ -62,12 +62,13 @@ export class OpenAIToolset extends BaseComposioToolset<OpenAiToolCollection, Ope
62 const appName = toolSchema?.toolkit?.name.toLowerCase();
63 const connectedAccountId = this.client.getConnectedAccountId(appName);
64
65 -
66 - const results = await this.client.tools.execute(toolSchema.slug, {
67 - arguments: JSON.parse(tool.function.arguments),
65 + const payload = {
66 entity_id: userId ?? this.client.userId,
67 connected_account_id: connectedAccountId,
70 - });
68 + arguments: JSON.parse(tool.function.arguments),
69 + }
70 +
71 + const results = await this.client.tools.execute(toolSchema.slug, payload);
72
73 return JSON.stringify(results);
74 }