Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Automatically switch provider based on envirnment variables, Ollama support: closes #13#50

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
Le09 wants to merge2 commits intoThe-Pocket:main
base:main
Choose a base branch
Loading
fromLe09:main

Conversation

Le09
Copy link

Fairly straightforward. In the spirit of the repo, I've kept things simple rather than also automatically add everything (like optional Anthropic libraries or others).

I think asking beginners to modify directlycall_llm poses a risk of them putting their private keys on Github, so it's better to have them learn how to use environment variables to avoid taking chances.

thoroc reacted with thumbs up emojipiranna, zachary62, eliliam, ksylvan, and redliu312 reacted with heart emoji
@zachary62
Copy link
Member

Thank you! I'm a bit worried thatenv will add friction to semi-technical people, but will add notes about security issue

Le09 reacted with thumbs up emoji

Copy link

@eliliameliliam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Nice and clean, very extensible too if anyone wanted to add new providers down the line.

@redliu312
Copy link

hihi@Le09

do you think it is required to add

from dotenv import load_dotenvload_dotenv()

in the top section of the call_llm.py

I tried your branch and it seems this is needed for load the .env file when the script executed

@Le09
Copy link
Author

@redliu312 Oh, I see.
Environment variables are variables that are set in you terminal. So a standard development workflow is to do

workon Tutorial-Codebase-Knowledge-venv# activate your virtual environment with the correct set of python dependenciessource .env# load the API keyspython file.py

If done this way, the variables are available in everything that you do in this terminal. Sopython main.py andpython utils.call_llm.py would both get variables.
If you do the call from main, then main loads the variable first so call_llm should get them.
So, the issue is that callingutils/call_llm directly does not get them from main; since this is for testing purpose, theload_dotenv() should indeed be added to this file, but under theif __name__ == "__main__": line.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@eliliameliliameliliam approved these changes

@samin-irtizasamin-irtizasamin-irtiza approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

5 participants
@Le09@zachary62@redliu312@eliliam@samin-irtiza

[8]ページ先頭

©2009-2025 Movatter.jp