New Project: AI Competitor Intelligence Agent
This commit is contained in:
parent
abb2cffa62
commit
98c5222a6f
5 changed files with 33 additions and 0 deletions
32
ai_agent_tutorials/ai_competitors_analysis_team/exaai.py
Normal file
32
ai_agent_tutorials/ai_competitors_analysis_team/exaai.py
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
from exa_py import Exa
|
||||
|
||||
# Initialize Exa with your API key
|
||||
exa = Exa(api_key="EXA_API_KEY")
|
||||
|
||||
def get_competitor_urls(url=None, description=None):
|
||||
if url:
|
||||
# Use the URL-based API call
|
||||
result = exa.find_similar(
|
||||
url=url,
|
||||
num_results=5,
|
||||
exclude_source_domain=True,
|
||||
category="company"
|
||||
)
|
||||
elif description:
|
||||
# Use the description-based API call
|
||||
result = exa.search(
|
||||
description,
|
||||
type="neural",
|
||||
category="company",
|
||||
use_autoprompt=True,
|
||||
num_results=5
|
||||
)
|
||||
else:
|
||||
raise ValueError("Please provide either a URL or a description.")
|
||||
|
||||
# Extracting and return only the competitor URLs
|
||||
competitor_urls = [item.url for item in result.results]
|
||||
return competitor_urls
|
||||
# return result
|
||||
|
||||
print(get_competitor_urls(description="Competitors of a company that works on AI Neuro Health Tech"))
|
||||
0
ai_agent_tutorials/ai_competitors_analysis_team/main.py
Normal file
0
ai_agent_tutorials/ai_competitors_analysis_team/main.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
exa-py==1.0.6
|
||||
Loading…
Reference in a new issue