Skip to content

Commit

Permalink
Merge branch 'master' of github.com:ComposioHQ/composio into ft-js-de…
Browse files Browse the repository at this point in the history
…v-track
  • Loading branch information
himanshu-dixit committed Dec 19, 2024
2 parents 1d62448 + cc3ec3d commit e3ef656
Show file tree
Hide file tree
Showing 72 changed files with 4,447 additions and 2,331 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/common.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: main_workflow
on:
# Run a cron job every 12 hours
schedule:
- cron: '0 */12 * * *'
push:
branches:
- master
Expand Down Expand Up @@ -104,6 +107,19 @@ jobs:
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Slack Notification on Failure
if: ${{ failure() && github.ref == 'refs/heads/master' && !contains(github.event.head_commit.message, 'release') && !contains(github.event.head_commit.message, 'Release') && !inputs.dont_notify }}
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_TECH_WEBHOOK }}
SLACK_TITLE: "Example Tests Failed"
SLACK_MSG_AUTHOR: ${{ inputs.author || github.actor }}
SLACK_MESSAGE: "<@viraj> <@tushar sadhwani> ${{ inputs.commit_message || github.event.head_commit.message }}"
SLACK_LINK_NAMES: "true"
SLACK_COLOR: "failure"
SLACK_USERNAME: "GitHub Actions Bot"
SLACK_ICON_EMOJI: ":x:"
SLACK_FOOTER: "Failed Example Tests | GitHub Actions"

swe:
defaults:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/examples.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Example Tests

on:
# Run a cron job every 12 hours
schedule:
- cron: '0 */12 * * *'
workflow_call:
inputs:
working-directory:
Expand Down Expand Up @@ -102,7 +105,7 @@ jobs:
SLACK_WEBHOOK: ${{ secrets.SLACK_TECH_WEBHOOK }}
SLACK_TITLE: "Example Tests Failed"
SLACK_MSG_AUTHOR: ${{ inputs.author || github.actor }}
SLACK_MESSAGE: "<@viraj> <@kaavee> ${{ inputs.commit_message || github.event.head_commit.message }}"
SLACK_MESSAGE: "<@viraj> <@tushar sadhwani> ${{ inputs.commit_message || github.event.head_commit.message }}"
SLACK_LINK_NAMES: "true"
SLACK_COLOR: "failure"
SLACK_USERNAME: "GitHub Actions Bot"
Expand Down
2 changes: 1 addition & 1 deletion docs/introduction/intro/quickstart_2.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ We'll use Jessica as our example user. There are multiple ways to authenticate a
```javascript Authenticate Jessica's Google Calendar Account
import { Composio } from "composio-core";

const client = new Composio(process.env.COMPOSIO_API_KEY);
const client = new Composio({ apiKey: process.env.COMPOSIO_API_KEY });

const entity = await client.getEntity("Jessica");
const connection = await entity.initiateConnection('googlecalendar');
Expand Down
27 changes: 21 additions & 6 deletions docs/mint.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,28 @@
]
},
{
"group": "SWE Kit",
"group": "Kits",
"pages": [
"swekit-tools/introduction",
"swekit-js/introduction",
"swekit/introduction",
"swekit/benchmarks",
"swekit-examples/introduction"
{
"group": "SWE kit",
"pages": [
"swekit-tools/introduction",
"swekit-js/introduction",
"swekit/introduction",
"swekit/benchmarks",
"swekit-examples/introduction"
]
},
{
"group":"AI SDR Kit",
"pages": [
"sdrkit/tools",
"sdrkit/ai-lead-generator",
"sdrkit/ai-outreach-agent",
"sdrkit/ai-market-research-agent",
"sdrkit/ai-scheduling-agent"
]
}
]
},
{
Expand Down
222 changes: 222 additions & 0 deletions docs/sdrkit/ai-lead-generator.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
---
title: "AI Lead Generator Agent"
sidebarTitle: "AI Lead Generator"
icon: "user-plus"
description: "This project demonstrates how to use Composio to create a lead generation agent."
---

## Overview

The AI Lead Generator Agent is a powerful tool built using Composio’s tooling ecosystem and agentic frameworks such as LlamaIndex. This agent streamlines the lead generation process for businesses by identifying potential leads, extracting valuable data, and organizing all lead information into a structured spreadsheet. With a user-friendly setup process and seamless integration capabilities, this agent can significantly enhance your outreach efficiency and sales pipeline management.
## Getting Started

<Tabs>
<Tab title="Python">
<Steps>
<Step title="Installation">
```bash install dependencies
pip install composio-llamaindex python-dotenv
```
</Step>

<Step title="Connecting to tools and models">
```bash connect to required tools
composio add peopledatalabs
composio add googlesheets

export OPENAI_API_KEY="<your-openai-api-key>"
```
</Step>

<Step title="Importing the required libraries">
```python import required libraries
from composio_llamaindex import ComposioToolSet, App, Action
from llama_index.core.agent import FunctionCallingAgentWorker
from llama_index.core.llms import ChatMessage
from llama_index.llms.openai import OpenAI
from dotenv import load_dotenv

load_dotenv()
```
</Step>

<Step title="Initializing the Tools and the LLM">
```python initialize toolset and llm
toolset = ComposioToolSet(api_key="")
tools = toolset.get_tools(apps=[App.PEOPLEDATALABS, App.GOOGLESHEETS])

llm = OpenAI(model="gpt-4o")
```
</Step>

<Step title="Setting up Function Calling Worker">
```python setup function calling worker
spreadsheetid = '14T4e0j1XsWjriQYeFMgkM2ihyvLAplPqB9q8hytytcw'
prefix_messages = [
ChatMessage(
role="system",
content=(
f"""
You are a lead research agent. Based on user input, find 10 relevant leads using people data labs.
After finding the leads, create a Google Sheet with the details for the lead description, and spreadsheet ID: ${spreadsheetid}.
Print the list of people and their details and the link to the google sheet."""
),
)
]

agent = FunctionCallingAgentWorker(
tools=tools,
llm=llm,
prefix_messages=prefix_messages,
max_function_calls=10,
allow_parallel_tool_calls=False,
verbose=True,
).as_agent()
```
</Step>

<Step title="Executing the Agent">
```python run the agent
lead_description = 'Senior frontend developers in San Francisco'
user_input = f"Create a lead list based on the description: {lead_description}"
response = agent.chat(user_input)
```
</Step>

<Step title='Final Code'>
```python final code
from composio_llamaindex import ComposioToolSet, App, Action
from llama_index.core.agent import FunctionCallingAgentWorker
from llama_index.core.llms import ChatMessage
from llama_index.llms.openai import OpenAI
from dotenv import load_dotenv

load_dotenv()
toolset = ComposioToolSet(api_key="")
tools = toolset.get_tools(apps=[App.PEOPLEDATALABS, App.GOOGLESHEETS])

llm = OpenAI(model="gpt-4o")

spreadsheetid = '14T4e0j1XsWjriQYeFMgkM2ihyvLAplPqB9q8hytytcw'
prefix_messages = [
ChatMessage(
role="system",
content=(
f"""
You are a lead research agent. Based on user input, find 10 relevant leads using people data labs.
After finding the leads, create a Google Sheet with the details for the lead description, and spreadsheet ID: ${spreadsheetid}.
Print the list of people and their details and the link to the google sheet."""
),
)
]

agent = FunctionCallingAgentWorker(
tools=tools,
llm=llm,
prefix_messages=prefix_messages,
max_function_calls=10,
allow_parallel_tool_calls=False,
verbose=True,
).as_agent()

lead_description = 'Senior frontend developers in San Francisco'
user_input = f"Create a lead list based on the description: {lead_description}"
response = agent.chat(user_input)
```
</Step>
</Steps>
</Tab>

<Tab title="Javascript">
<Steps>
<Step title="Installation">
```bash install dependencies
npm install composio-core ai @ai-sdk/openai dotenv
```
</Step>

<Step title="Connecting to tools and models">
```bash connect to required tools
composio add peopledatalabs
composio add googlesheets

export OPENAI_API_KEY="<your-openai-api-key>"
export COMPOSIO_API_KEY="<your-composio-api-key>"
```
</Step>

<Step title="Importing the required libraries">
```javascript import required libraries
import { openai } from "@ai-sdk/openai";
import { VercelAIToolSet } from "composio-core";
import dotenv from "dotenv";
import { generateText } from "ai";

dotenv.config();
```
</Step>

<Step title="Initializing the Tools and the LLM">
```javascript initialize toolset and llm
const toolset = new VercelAIToolSet({
apiKey: process.env.COMPOSIO_API_KEY,
});

const tools = await toolset.getTools([App.PEOPLEDATALABS, App.GOOGLESHEETS]);
```
</Step>

<Step title="Setting up Agent">
```javascript setup the ai agent
const leadDescription = 'Senior frontend developers in San Francisco';
const spreadsheetid='14T4e0j1XsWjriQYeFMgkM2ihyvLAplPqB9q8hytytcw'
const output = await generateText({
model: openai("gpt-4o"),
streamText: false,
tools: tools,
prompt: `
You are a lead research agent. Based on user input, find 10 relevant leads using people data labs.
After finding the leads, create a Google Sheet with the details for the lead description: ${leadDescription}, and spreadsheet ID: ${spreadsheetid}.
Print the list of people and their details and the link to the google sheet.
`,
maxToolRoundtrips: 5,
});
```
</Step>

<Step title='Final Code'>
```javascript final code
import { openai } from "@ai-sdk/openai";
import { VercelAIToolSet } from "composio-core";
import dotenv from "dotenv";
import { generateText } from "ai";

dotenv.config();

const toolset = new VercelAIToolSet({
apiKey: process.env.COMPOSIO_API_KEY,
});

const tools = await toolset.getTools([App.PEOPLEDATALABS, App.GOOGLESHEETS]);

const leadDescription = 'Senior frontend developers in San Francisco';
const spreadsheetid='14T4e0j1XsWjriQYeFMgkM2ihyvLAplPqB9q8hytytcw'
const output = await generateText({
model: openai("gpt-4o"),
streamText: false,
tools: tools,
prompt: `
You are a lead research agent. Based on user input, find 10 relevant leads using people data labs.
After finding the leads, create a Google Sheet with the details for the lead description: ${leadDescription}, and spreadsheet ID: ${spreadsheetid}.
Print the list of people and their details and the link to the google sheet.
`,
maxToolRoundtrips: 5,
});

console.log("🎉Output from agent: ", output.text);

```
</Step>
</Steps>
</Tab>
</Tabs>
Loading

0 comments on commit e3ef656

Please sign in to comment.