-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
29 lines (23 loc) · 825 Bytes
/
Copy pathtest.js
File metadata and controls
29 lines (23 loc) · 825 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { OpenAI } from "openai";
import { OpenAIToolSet } from "composio-core";
const openai_client = new OpenAI({apiKey: process.env.OPENAI_API_KEY});
// Initialise the Composio Tool Set
const composio_toolset = new OpenAIToolSet({
apiKey: process.env.COMPOSIO_API_KEY
});
async function main() {
const tools = await composio_toolset.getTools({
actions: ["github_star_a_repository_for_the_authenticated_user"],
});
const instruction = "Star a repo composiohq/composio on GitHub";
// Initialise the Composio Tool Set
const response = await openai_client.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "user", content: instruction }],
tools: tools,
tool_choice: "auto",
});
const resp = await composio_toolset.handleToolCall(response);
console.log(resp);
}
main();