aisuite
aisuite copied to clipboard
Add Sentiment Analysis Example Using Anthropics' Claude Model
Pull Request: Add Sentiment Analysis Example Using Anthropics' Claude Model
Overview
This pull request introduces a new example notebook (SentimentAnalysis.ipynb) to the examples folder. The notebook demonstrates how to perform sentiment analysis using the aisuite library with Anthropics' Claude-3-5-sonnet model.
Key Features
-
Integration with Anthropics' Claude Model: Uses the
aisuitelibrary to interact withClaude-3-5-sonnet. - Sentiment Analysis Workflow: Includes prompts and configurations to analyze text sentiment (positive/negative).
- Environment Setup: Demonstrates API key setup using environment variables for secure integration.
- Reusable Example: Provides a clear and reusable structure for developers to perform sentiment analysis with LLMs.
File Details
SentimentAnalysis.ipynb
-
Dependencies
- Install the necessary library using:
pip install anthropic
- Install the necessary library using:
-
API Key Setup
- Securely configure API keys using:
import os os.environ["ANTHROPIC_API_KEY"] = "<your-anthropic-api-key>"
- Securely configure API keys using:
-
Sentiment Analysis Code
- Prompt the model to analyze text sentiment (positive/negative).
- Example response:
Pakistan: The Sentiment is positive
Testing
- Verified functionality with real API keys and the Anthropics library.
- Output is consistent with the prompts and expectations.
Why This Contribution?
This example provides a practical use case for developers leveraging aisuite for natural language processing tasks. It aligns with the repository's goal of offering unified access to multiple LLM providers.
Checklist
- [x] Added the
SentimentAnalysis.ipynbexample. - [x] Included detailed comments and documentation in the notebook.
- [x] Verified the code's functionality and output.
Feedback and Suggestions
Maintainers are welcome to provide feedback or suggest improvements for this contribution.