Public
Like
1
openai-agents
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Viewing readonly version of sentiment-analysis branch: v8View latest version
A Val Town template for analyzing sentiment around topics or names using the OpenAI Agents SDK. This agent searches news articles, social media, and web content from the last week to provide structured sentiment analysis.
-
Remix this val
-
Set the
OPENAI_API_KEYenvironment variable. Get your OpenAI API key here: https://platform.openai.com/api-keys -
Use your agent:
Send POST requests to your val endpoint:
curl -X POST https://openai-agents.val.run \ -H "Content-Type: application/json" \ -d '{"message": "Analyze the sentiment around OpenAI in the last week"}'
The agent returns structured JSON with:
topic: The topic analyzedoverallSentiment: positive, negative, neutral, or mixedsentimentScores: Percentage breakdown of sentiment typeskeyThemes: Main themes discovered in the analysissummary: Brief overview of findingsexamples: Specific excerpts with sources and their sentimentsourcesAnalyzed: Number of sources reviewed
Edit the agent configuration in main.ts to:
- Adjust the time range for analysis
- Modify the output format
- Change the model or add custom tools