Skip to content

Commit

Permalink
Merge branch 'master' into ENG-3203
Browse files Browse the repository at this point in the history
  • Loading branch information
Devanshusisodiya authored Feb 25, 2025
2 parents 64cc20c + f9da75f commit 4f92ef7
Show file tree
Hide file tree
Showing 33 changed files with 107 additions and 52 deletions.
34 changes: 19 additions & 15 deletions js/config/getTestConfig.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
export const env = process.env.TEST_ENV || "staging"
export const env = "staging";
const CURRENT_FILE_DIR = __dirname;

export type BACKEND_CONFIG = {
COMPOSIO_API_KEY: string;
BACKEND_HERMES_URL: string;
drive: {
downloadable_file_id: string;
}
}
COMPOSIO_API_KEY: string;
BACKEND_HERMES_URL: string;
drive: {
downloadable_file_id: string;
};
};

export const getTestConfig = (): BACKEND_CONFIG => {
const path = `${CURRENT_FILE_DIR}/test.config.${env}.json`;
try {
return JSON.parse(JSON.stringify(require(path))) as unknown as BACKEND_CONFIG;
} catch (error) {
console.error("Error loading test config file:", error);
throw new Error(`Error loading test config file. You can create test.config.${env}.json file in the config folder.`);
}
}
const path = `${CURRENT_FILE_DIR}/test.config.${env}.json`;
try {
return JSON.parse(
JSON.stringify(require(path))
) as unknown as BACKEND_CONFIG;
} catch (error) {
console.error("Error loading test config file:", error);
throw new Error(
`Error loading test config file. You can create test.config.${env}.json file in the config folder.`
);
}
};
12 changes: 9 additions & 3 deletions js/src/frameworks/vercel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ export class VercelAIToolSet extends BaseComposioToolSet {
});
}

private generateVercelTool(schema: RawActionData) {
private generateVercelTool(
schema: RawActionData,
entityId: Optional<string> = null
) {
return tool({
description: schema.description,
// @ts-ignore the type are JSONSchemV7. Internally it's resolved
Expand All @@ -50,7 +53,7 @@ export class VercelAIToolSet extends BaseComposioToolSet {
name: schema.name,
arguments: JSON.stringify(params),
},
this.entityId
entityId || this.entityId
);
},
});
Expand Down Expand Up @@ -99,7 +102,10 @@ export class VercelAIToolSet extends BaseComposioToolSet {

const tools: { [key: string]: CoreTool } = {};
actionsList.forEach((actionSchema) => {
tools[actionSchema.name!] = this.generateVercelTool(actionSchema);
tools[actionSchema.name!] = this.generateVercelTool(
actionSchema,
entityId
);
});

return tools;
Expand Down
15 changes: 14 additions & 1 deletion js/src/sdk/models/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
ZGetListActionsParams,
ZParameter,
} from "../types/action";
import ComposioSDKContext from "../utils/composioContext";
import { CEG } from "../utils/error";
import { TELEMETRY_LOGGER } from "../utils/telemetry";
import { TELEMETRY_EVENTS } from "../utils/telemetry/events";
Expand Down Expand Up @@ -151,7 +152,19 @@ export class Actions {
try {
const parsedData = ZExecuteParams.parse(data);
const { data: res } = await apiClient.actionsV2.executeActionV2({
body: parsedData.requestBody as unknown as ActionExecutionReqDTO,
body: {
...parsedData.requestBody,
sessionInfo: {
...(parsedData.requestBody?.sessionInfo || {}),
...(parsedData.requestBody?.allowTracing
? {
sessionId:
parsedData.requestBody?.sessionInfo?.sessionId ||
ComposioSDKContext.sessionId,
}
: {}),
},
} as ActionExecutionReqDTO,
path: {
actionId: parsedData.actionName,
},
Expand Down
6 changes: 6 additions & 0 deletions js/src/sdk/types/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ export const ZExecuteParams = z.object({
appName: z.string().optional(),
text: z.string().optional(),
authConfig: ZCustomAuthParams.optional(),
allowTracing: z.boolean().optional(),
sessionInfo: z
.object({
sessionId: z.string().optional(),
})
.optional(),
}),
});

Expand Down
1 change: 1 addition & 0 deletions js/src/sdk/utils/telemetry/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export class TELEMETRY_LOGGER {
composioVersion: ComposioSDKContext.composioVersion,
frameworkRuntime: ComposioSDKContext.frameworkRuntime,
source: ComposioSDKContext.source,
sessionId: ComposioSDKContext.sessionId,
isBrowser: typeof window !== "undefined",
},
};
Expand Down
1 change: 1 addition & 0 deletions js/src/utils/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { getEnvVariable } from "./shared";

// Define log levels with corresponding priorities
export const LOG_LEVELS = {
silent: -1, // No logs
error: 0, // Highest priority - critical errors
warn: 1, // Warning messages
info: 2, // General information
Expand Down
2 changes: 1 addition & 1 deletion python/composio/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.7.2"
__version__ = "0.7.4"
16 changes: 15 additions & 1 deletion python/composio/client/files.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

import hashlib
import os
import typing as t
from pathlib import Path

Expand Down Expand Up @@ -56,9 +57,22 @@ def from_path(
action: str,
app: str,
) -> te.Self:

file = Path(file)
if not file.exists():
raise SDKFileNotFoundError(f"File not found: {file}")
raise SDKFileNotFoundError(
f"File not found: {file}. Please provide a valid file path."
)

if not file.is_file():
raise SDKFileNotFoundError(
f"Not a file: {file}. Please provide a valid file path."
)

if not os.access(file, os.R_OK):
raise SDKFileNotFoundError(
f"File not readable: {file}. Please check the file permissions."
)

mimetype = mimetypes.guess(file=file)
s3meta = client.actions.create_file_upload(
Expand Down
3 changes: 2 additions & 1 deletion python/composio/tools/base/abs.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,9 @@ def _get_description(obj) -> str:
.strip()
),
)
description = " ".join(description.split())
description, separator, enum = description.partition(DEPRECATED_MARKER)
return inflection.titleize(description) + separator + enum
return inflection.humanize(description) + separator + enum


class ActionMeta(type):
Expand Down
11 changes: 10 additions & 1 deletion python/composio/tools/toolset.py
Original file line number Diff line number Diff line change
Expand Up @@ -665,12 +665,21 @@ def _substitute_file_uploads_recursively(
request: t.Dict,
action: Action,
) -> t.Dict:
if "properties" not in schema:
return request

params = schema["properties"]
for _param in request:
params_to_process = list(request.keys())
for _param in params_to_process:
if _param not in params:
continue

if self._file_uploadable(schema=params[_param]):
# skip if the file is not provided
if request[_param] is None or request[_param] == "":
del request[_param]
continue

request[_param] = FileUploadable.from_path(
file=request[_param],
client=self._client(),
Expand Down
2 changes: 1 addition & 1 deletion python/dockerfiles/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ RUN /bin/python3 -m venv .composio/venv
RUN export PATH=$PATH:$(pwd)/.composio/venv/bin

# Install composio
RUN python -m pip install composio-core[all]==0.7.2 fastapi playwright uvicorn
RUN python -m pip install composio-core[all]==0.7.4 fastapi playwright uvicorn

# Install playwright deps
RUN playwright install-deps
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/agno/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name="composio_agno",
version="0.7.2",
version="0.7.4",
author="Devanshu",
author_email="[email protected]",
description="Use Composio to get an array of tools with your Agno Plugin.",
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/autogen/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name="composio_autogen",
version="0.7.2",
version="0.7.4",
author="Sawradip",
author_email="[email protected]",
description="Use Composio to get an array of tools with your Autogen agent.",
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/camel/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name="composio_camel",
version="0.7.2",
version="0.7.4",
author="Sawradip",
author_email="[email protected]",
description="Use Composio to get an array of tools with your Claude LLMs.",
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/claude/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name="composio_claude",
version="0.7.2",
version="0.7.4",
author="Sawradip",
author_email="[email protected]",
description="Use Composio to get an array of tools with your Claude LLMs.",
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/crew_ai/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name="composio_crewai",
version="0.7.2",
version="0.7.4",
author="Himanshu",
author_email="[email protected]",
description="Use Composio to get an array of tools with your CrewAI agent.",
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/gemini/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name="composio_gemini",
version="0.7.2",
version="0.7.4",
author="Composio",
author_email="[email protected]",
description="Use Composio to get an array of tools with your Gemini agent.",
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/google/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name="composio_google",
version="0.7.2",
version="0.7.4",
author="Assistant",
author_email="[email protected]",
description="Use Composio to get an array of tools with your Google AI Python Gemini model.",
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/griptape/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name="composio_griptape",
version="0.7.2",
version="0.7.4",
author="Sawradip",
author_email="[email protected]",
description="Use Composio to get an array of tools with your Griptape workflow.",
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/julep/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name="composio_julep",
version="0.7.2",
version="0.7.4",
author="Sawradip",
author_email="[email protected]",
description="Use Composio to get an array of tools with your Julep workflow.",
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/langchain/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name="composio_langchain",
version="0.7.2",
version="0.7.4",
author="Karan",
author_email="[email protected]",
description="Use Composio to get an array of tools with your LangChain agent.",
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/langgraph/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name="composio_langgraph",
version="0.7.2",
version="0.7.4",
author="Sawradip",
author_email="[email protected]",
description="Use Composio to get array of tools with LangGraph Agent Workflows",
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/llamaindex/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name="composio_llamaindex",
version="0.7.2",
version="0.7.4",
author="Sawradip",
author_email="[email protected]",
description="Use Composio to get an array of tools with your LlamaIndex agent.",
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/lyzr/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name="composio_lyzr",
version="0.7.2",
version="0.7.4",
author="Sawradip",
author_email="[email protected]",
description="Use Composio to get an array of tools with your Lyzr workflow.",
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/openai/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name="composio_openai",
version="0.7.2",
version="0.7.4",
author="Sawradip",
author_email="[email protected]",
description="Use Composio to get an array of tools with your OpenAI Function Call.",
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/phidata/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name="composio_phidata",
version="0.7.2",
version="0.7.4",
author="Sawradip",
author_email="[email protected]",
description="Use Composio to get an array of tools with your Phidata Plugin.",
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/praisonai/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name="composio_praisonai",
version="0.7.2",
version="0.7.4",
author="Sawradip",
author_email="[email protected]",
description="Use Composio Tools to enhance your PraisonAI agents capabilities.",
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/pydanticai/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name="composio_pydanticai",
version="0.7.2",
version="0.7.4",
author="Siddharth",
author_email="[email protected]",
description="Use Composio to get array of strongly typed tools for Pydantic AI",
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/smolagent/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name="composio_smol",
version="0.7.2",
version="0.7.4",
author="Composio",
author_email="[email protected]",
description="Use Composio to get array of strongly typed tools for Smol Agents",
Expand Down
2 changes: 1 addition & 1 deletion python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def scan_for_package_data(

setup(
name="composio_core",
version="0.7.2",
version="0.7.4",
author="Utkarsh",
author_email="[email protected]",
description="Core package to act as a bridge between composio platform and other services.",
Expand Down
2 changes: 1 addition & 1 deletion python/swe/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def scan_for_package_data(

setup(
name="swekit",
version="0.4.2",
version="0.4.4",
author="Shubhra",
author_email="[email protected]",
description="Tools for running a SWE agent using Composio platform",
Expand Down
Loading

0 comments on commit 4f92ef7

Please sign in to comment.