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(main.py): use model_api_key determined from get_api_key #3348

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nobu007
Copy link
Contributor

@nobu007 nobu007 commented Apr 29, 2024

Title

fix(main.py): use model_api_key determined from get_api_key

Relevant issues

None

Type

🧹 Refactoring

Changes

  • set model_api_key as api_key

Testing

  1. export ANTHROPIC_API_KEY=XXX
  2. use litellm.completion() without api_key.
import os
from litellm import completion

model="anthropic/claude-3-haiku-20240307"
messages = [{"role": "user", "content": "Hey! how's it going?"}]
response = completion(model=model, messages=messages)
print(response)

Notes

I thought this fix made it possible to read ANTHROPIC_API_KEY, but I can no longer reproduce it.
Perhaps one of the following would have worked:
In any case, I think it is better to include processing using model_api_key.

  • LITELLM_LOCAL_MODEL_COST_MAP="True"
  • It depends on message length or someting.

Pre-Submission Checklist (optional but appreciated):

  • I have included relevant documentation updates (stored in /docs/my-website)

OS Tests (optional but appreciated):

  • Tested on Windows
  • Tested on MacOS
  • Tested on Linux

Copy link

vercel bot commented Apr 29, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
litellm ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 6, 2024 8:47am

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.

1 participant