Skip to content
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

Fix: LLM API Key Error Handling #427

Merged
merged 18 commits into from
Jan 19, 2025
Merged

Conversation

XiangZhang-zx
Copy link
Contributor

@XiangZhang-zx XiangZhang-zx commented Jan 19, 2025

What's Changed

  • Added proper error handling for invalid API keys
  • Fixed response parsing for LiteLLM completion calls
  • Returns helpful error messages instead of crashing
Screenshot 2025-01-19 at 9 07 31 AM Screenshot 2025-01-19 at 9 07 44 AM

Fixes #426

XiangZhang-zx and others added 18 commits January 6, 2025 10:43
Problem: The system was using environment variables for API keys.
Solution: Changed the code to first check the config file for API keys. If not found, it falls back to environment variables.
Impact: Ensures API keys are managed centrally in the config file, improving flexibility and control.
Before: Workflow always used main branch code
After: Workflow uses PR code when testing PR
# Description
This PR enables AIOS kernel to dynamically handle LLM configurations from users, allowing:

1. Dynamic API key updates for different LLM providers
2. Runtime configuration refresh without restart
3. Secure API key management

## Changes
- Added config update endpoint in kernel
- Added configuration refresh mechanism
- Updated environment variable handling
## What's Changed
- Added proper error handling for invalid API keys
- Fixed response parsing for LiteLLM completion calls
- Added HTTP status codes for different error types:
  - 402 for API key issues
  - 500 for other errors
@dongyuanjushi dongyuanjushi merged commit 3b0036f into agiresearch:main Jan 19, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Kernel crashes when API key is invalid
2 participants