Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
TypeScript agentic-aiagentsaiai-agentsaiagentsdeveloper-toolsfunction-callinggpt-4javascriptjsllmllmopsmcppythonremote-mcp-serverssetypescript
Remove unwanted generics
haxzie5e2cea9518eb
diff --git a/examples/openai/src/index.ts b/examples/openai/src/index.tsindex 669b7c93f..e701ce9ea 100644--- a/examples/openai/src/index.ts+++ b/examples/openai/src/index.ts@@ -16,6 +16,8 @@ const composio = new Composio({// these tools are automatically typed and wrapped with the OpenAI Toolsetconst tool = await composio.getTool("HACKERNEWS_GET_USER");+await composio.toolset.getTool("HACKERNEWS_GET_USER");+const task = "Fetch the details of the user 'haxzie'";diff --git a/packages/core/src/composio.ts b/packages/core/src/composio.tsindex 794672d57..d7f07651d 100644--- a/packages/core/src/composio.ts+++ b/packages/core/src/composio.ts@@ -16,7 +16,7 @@ import { IS_DEVELOPMENT_OR_CI } from "./utils/constants";import { checkForLatestVersionFromNPM } from "./utils/version";-export type ComposioConfig<TToolCollection, TTool, TToolset extends BaseComposioToolset<TToolCollection, TTool>> = {+export type ComposioConfig<TToolset extends BaseComposioToolset<any, any>> = {apiKey?: string;baseURL?: string;allowTracking?: boolean;@@ -31,7 +31,7 @@ export type ComposioConfig<TToolCollection, TTool, TToolset extends BaseComposio* This is the core class for Composio.* It is used to initialize the Composio SDK and provide a global configuration.*/-export class Composio<TToolCollection, TTool, TToolset extends BaseComposioToolset<TToolCollection, TTool>> {+export class Composio<TToolset extends BaseComposioToolset<any, any>> {private readonly DEFAULT_USER_ID = "default";readonly FILE_NAME = "core/composio.ts";@@ -46,7 +46,7 @@ export class Composio<TToolCollection, TTool, TToolset extends BaseComposioTools* The configuration for the Composio SDK.* @type {ComposioConfig<TTool, TToolset>}*/- private config: ComposioConfig<TToolCollection, TTool, TToolset>;+ private config: ComposioConfig<TToolset>;private telemetry: Telemetry<InstrumentedInstance> | undefined;@@ -76,7 +76,7 @@ export class Composio<TToolCollection, TTool, TToolset extends BaseComposioTools* @param {boolean} config.allowTracing Whether to allow tracing. Defaults to true.* @param {TS} config.toolset The toolset to use for this Composio instance.*/- constructor(config: ComposioConfig<TToolCollection, TTool, TToolset>) {+ constructor(config: ComposioConfig<TToolset>) {const { baseURL: baseURLParsed, apiKey: apiKeyParsed } = getSDKConfig(config?.baseURL,@@ -116,7 +116,7 @@ export class Composio<TToolCollection, TTool, TToolset extends BaseComposioTools/*** Set the default toolset, if not provided by the user.*/- this.toolset = config.toolset ?? new ComposioToolset() as unknown as TToolset;+ this.toolset = (config.toolset ?? new ComposioToolset()) as TToolset;this.toolset.setClient(this);/**diff --git a/packages/core/src/toolset/BaseToolset.ts b/packages/core/src/toolset/BaseToolset.tsindex 33857385a..10819f904 100644--- a/packages/core/src/toolset/BaseToolset.ts+++ b/packages/core/src/toolset/BaseToolset.ts@@ -13,15 +13,15 @@ import { Composio } from "../composio";* eg:* class YourToolSet extends BaseComposioToolset<CustomToolCollection, CustomTool> {}*/-export abstract class BaseComposioToolset<TToolCollection, TTool = BaseTool> implements Toolset<TTool, TToolCollection> {- protected client: Composio<TToolCollection, TTool, this> | undefined;+export abstract class BaseComposioToolset<TToolCollection, TTool> implements Toolset<TTool, TToolCollection> {+ protected client: Composio<this> | undefined;abstract FILE_NAME: string;/*** Set the client for the toolset. This is automatically done by the Composio class.* @param client - The Composio client.*/- setClient(client: Composio<TToolCollection, TTool, this>): void {+ setClient(client: Composio<this>): void {this.client = client;}