Composio allows developers to integrate external tools and services into their AI applications. It handles tool calling, web-hooks, authentication, and more.You need to register on a Composio account - Sign up here if you haven’t already to get their API key https://platform.composio.dev/
In this example, we will use Together AI to star a repository on GitHub using Composio Tools.
from composio_togetherai import ComposioToolSet, Appfrom together import Togetherclient = Together()toolset = ComposioToolSet()
/*We use the Vercel AI SDK with the Together provider to enable type checking to work correctly for tools and to simplify the Composio integration. This flow enables us to directly execute tool callswithout having to use composio.provider.handleToolCalls.*/import { Composio } from "@composio/core";import { VercelProvider } from "@composio/vercel";import { createTogetherAI } from "@ai-sdk/togetherai";import { generateText } from "ai";export const together = createTogetherAI({ apiKey: process.env.TOGETHER_API_KEY ?? "",});const composio = new Composio({ apiKey: process.env.COMPOSIO_API_KEY ?? "", provider: new VercelProvider(),});