Skip to content

Commit

Permalink
feat:ai market research agent python version docs updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Prat011 committed Dec 17, 2024
1 parent e59f5b3 commit 9c8c981
Showing 1 changed file with 81 additions and 31 deletions.
112 changes: 81 additions & 31 deletions docs/sdrkit/ai-market-research-agent.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,22 @@ 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."""
),
f"""
You are a market research agent that finds niche ideas that can be built and marketed.
Your users are primarily indie hackers who want to build something new and are looking for ideas. The input will
be a domain or a category and your job is to research extensively and find ideas that can be marketed.
Write this content in a google doc, create a google doc before writing in it.
I want you to show the following content:
- Data Collection and Aggregation - Show data supporting a trend
- Sentiment Analysis - Show customer sentiment on the topic
- Trend Forecasting
- Competitor Analysis
- Competitor Benchmarking
- Idea Validation
"""
)
)
]

agent = FunctionCallingAgentWorker(
tools=tools,
llm=llm,
Expand All @@ -79,9 +87,12 @@ agent = FunctionCallingAgentWorker(

<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)
a = input('Enter the domain or category you want to research about:')
task = f"""
The domain or category you want to research about is {a}. Use all the tools available to you to find and gather more insights on customers and market.
"""
response = agent.chat(task)
print(response)
```
</Step>

Expand All @@ -91,40 +102,65 @@ 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 llama_index.llms.cerebras import Cerebras
from llama_index.llms.groq import Groq
from dotenv import load_dotenv
from pathlib import Path
import os

load_dotenv()
toolset = ComposioToolSet(api_key="")
tools = toolset.get_tools(apps=[App.PEOPLEDATALABS, App.GOOGLESHEETS])
llm = OpenAI(model='gpt-4o')
#llm = Groq(model="llama3-groq-70b-8192-tool-use-preview")
#llm = Cerebras(model="llama3.1-70b")
composio_toolset = ComposioToolSet()
tools = composio_toolset.get_tools(apps = [App.TAVILY, App.GOOGLEDOCS])

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

spreadsheetid = '14T4e0j1XsWjriQYeFMgkM2ihyvLAplPqB9q8hytytcw'
# Set up prefix messages for the agent
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."""
),
f"""
You are a market research agent that finds niche ideas that can be built and marketed.
Your users are primarily indie hackers who want to build something new and are looking for ideas. The input will
be a domain or a category and your job is to research extensively and find ideas that can be marketed.
Write this content in a google doc, create a google doc before writing in it.
I want you to show the following content:
- Data Collection and Aggregation - Show data supporting a trend
- Sentiment Analysis - Show customer sentiment on the topic
- Trend Forecasting
- Competitor Analysis
- Competitor Benchmarking
- Idea Validation
"""
)
)
]


agent = FunctionCallingAgentWorker(
tools=tools,
llm=llm,
prefix_messages=prefix_messages,
max_function_calls=10,
allow_parallel_tool_calls=False,
verbose=True,
tools=tools, # Tools available for the agent to use
llm=llm, # Language model for processing requests
prefix_messages=prefix_messages, # Initial system messages for context
max_function_calls=10, # Maximum number of function calls allowed
allow_parallel_tool_calls=False, # Disallow parallel tool calls
verbose=True, # Enable verbose output
).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)

agent = FunctionCallingAgentWorker(
tools=tools, # Tools available for the agent to use
llm=llm, # Language model for processing requests
prefix_messages=prefix_messages, # Initial system messages for context
max_function_calls=10, # Maximum number of function calls allowed
allow_parallel_tool_calls=False, # Disallow parallel tool calls
verbose=True, # Enable verbose output
).as_agent()
a = input('Enter the domain or category you want to research about:')
task = f"""
The domain or category you want to research about is {a}. Use all the tools available to you to find and gather more insights on customers and market.
"""
response = agent.chat(task)
print(response)
```
</Step>
</Steps>
Expand Down Expand Up @@ -183,7 +219,14 @@ const prompt = await pull("hwchase17/openai-functions-agent");
const additional = `You are a market research agent that finds niche ideas that can be built and marketed.
Your users are primarily indie hackers who want to build something new and are looking for ideas. The input will
be a domain or a category and your job is to research extensively and find ideas that can be marketed.
Also write the content to market a tool built with this idea. It should be very very specific and not too long.`;
Write this content in a google doc, create a google doc before writing in it.
I want you to show the following content:
- Data Collection and Aggregation - Show data supporting a trend
- Sentiment Analysis - Show customer sentiment on the topic
- Trend Forecasting
- Competitor Analysis
- Competitor Benchmarking
- Idea Validation`;

const agent = await createOpenAIFunctionsAgent({
llm,
Expand Down Expand Up @@ -236,7 +279,14 @@ const prompt = await pull("hwchase17/openai-functions-agent");
const additional = `You are a market research agent that finds niche ideas that can be built and marketed.
Your users are primarily indie hackers who want to build something new and are looking for ideas. The input will
be a domain or a category and your job is to research extensively and find ideas that can be marketed.
Also write the content to market a tool built with this idea. It should be very very specific and not too long.`;
Write this content in a google doc, create a google doc before writing in it.
I want you to show the following content:
- Data Collection and Aggregation - Show data supporting a trend
- Sentiment Analysis - Show customer sentiment on the topic
- Trend Forecasting
- Competitor Analysis
- Competitor Benchmarking
- Idea Validation`;

const agent = await createOpenAIFunctionsAgent({
llm,
Expand Down

0 comments on commit 9c8c981

Please sign in to comment.