-
Notifications
You must be signed in to change notification settings - Fork 982
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrate OpenRouter API and Environment Variables #44
Integrate OpenRouter API and Environment Variables #44
Conversation
Title: Integrate OpenRouter API and Environment Variables Branch: feature/openrouter-integration Description: This pull request adds support for the OpenRouter API and introduces environment variable management for secure configuration. Changes: 1. Add a new .env file for environment variables 2. Update .gitignore to exclude .env file 3. Add python-dotenv to requirements.txt 4. Modify main.py to use OpenRouter API and load environment variables 5. Update README.md with new features and setup instructions Files changed: - .env (new file) - .gitignore - requirements.txt - main.py - readme.md Detailed changes: 1. Create a new .env file: ``` ANTHROPIC_API_KEY=your_anthropic_api_key_here OPENROUTER_API_KEY=your_openrouter_api_key_here TAVILY_API_KEY=your_tavily_api_key_here ``` 2. Update .gitignore: ``` # Existing content ... # Environment variables .env ``` 3. Update requirements.txt: ``` # Existing requirements ... python-dotenv==0.19.2 ``` 4. Modify main.py: ```python import os from dotenv import load_dotenv import openai # Load environment variables load_dotenv() # Set up OpenAI client with OpenRouter openai.api_key = os.getenv("OPENROUTER_API_KEY") openai.api_base = os.getenv("OPENROUTER_BASE_URL") # Rest of the existing code ... # Update the chat completion call response = openai.ChatCompletion.create( model="openai/gpt-3.5-turbo", messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": user_input} ] ) # Rest of the existing code ... ``` 5. Update README.md: - Add information about new features: environment variable management and OpenRouter API integration - Update installation instructions to include setting up the .env file - Add a new section explaining environment variables and OpenRouter integration This pull request enhances the security and flexibility of the application by using environment variables for sensitive information and integrates the OpenRouter API for improved AI capabilities. It also updates the README to reflect these changes and provide users with updated setup instructions.
Partial duplicate of #20 |
A more surgical way of adding .env mechanics can be found as PR #59 |
just tested your implementation @PierrunoYT Somehow tools are not working with the openrouter, the script did not create files / folders. Here are my logs:
|
Mhh okay strange |
Hey @PierrunoYT, could you please update it to the latest (V2 version)? |
…uter APIs when starting the script.
… starting the script.
Hey I just tried to do it but not sure if it works. I could need some help and testing. |
@snake302 I deleted everything because it was a mess. |
Title: Integrate OpenRouter API and Environment Variables
Branch: feature/openrouter-integration
Description:
This pull request adds support for the OpenRouter API and introduces environment variable management for secure configuration.
Changes:
Files changed:
Detailed changes:
This pull request enhances the security and flexibility of the application by using environment variables for sensitive information and integrates the OpenRouter API for improved AI capabilities. It also updates the README to reflect these changes and provide users with updated setup instructions.