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

API key required even when using local language models #828

Open
3 tasks done
lostmygithubaccount opened this issue Feb 6, 2024 · 1 comment
Open
3 tasks done
Labels
bug Something isn't working

Comments

@lostmygithubaccount
Copy link
Contributor

lostmygithubaccount commented Feb 6, 2024

First check

  • I added a descriptive title to this issue.
  • I used the GitHub search to try to find a similar issue and didn't find one.
  • I searched the Marvin documentation for this issue.

Bug summary

one issue is that the BASE_URL option doesn't seem to be documented anywhere -- would be happy to contribute an example after I have this working well

the main bug here is that if I have ~/.marvin/.env like so:

# LOCAL
MARVIN_OPENAI_BASE_URL="http://127.0.0.1:8080/v1"

I get an error (much of the stacktrace omitted for brevity):

[ins] In [1]: import marvin
@
[ins] In [2]: @marvin.fn
         ...: def write_poem() -> str:
         ...:     """Writes a cool poem"""
         ...:

[ins] In [3]: write_poem()
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)

...

ValueError: OpenAI API key not found! Marvin will not work properly without it.

You can either:
    1. Set the `MARVIN_OPENAI_API_KEY` or `OPENAI_API_KEY` environment variables
    2. Set `marvin.settings.openai.api_key` in your code (not recommended for production)

If you do not have an OpenAI API key, you can create one at https://platform.openai.com/api-keys.

I can easily work around this by setting the MARVIN_OPENAI_API_KEY to any value, but I think ti shouldn't be required (at least if setting the base URL?)

Reproduction

see above

Error

see above

Versions

2.1.3

Additional context

No response

@zzstoatzz
Copy link
Collaborator

hi @lostmygithubaccount - good callout, thanks!

#830 improves the handling here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants