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

refactor: change openai api key assignment and model list retrieval #21

Merged
merged 6 commits into from
Nov 11, 2023

Conversation

ericmjl
Copy link
Owner

@ericmjl ericmjl commented Nov 11, 2023

  • Removed direct assignment of OpenAI API key in init.py
  • Created an OpenAI client in configure.py using the API key from environment variable
  • Replaced direct model list retrieval from OpenAI with client's model list method
  • Reordered import statements for better organization

- Removed direct assignment of OpenAI API key in __init__.py
- Created an OpenAI client in configure.py using the API key from environment variable
- Replaced direct model list retrieval from OpenAI with client's model list method
- Reordered import statements for better organization
This commit moves the filename generation logic into the condition that checks if a save_path is provided.
This ensures that the filename generation logic is only executed when necessary, improving efficiency.
Copy link

codecov bot commented Nov 11, 2023

Codecov Report

Attention: 5 lines in your changes are missing coverage. Please review.

Comparison is base (745b279) 62.31% compared to head (4a30e96) 62.65%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #21      +/-   ##
==========================================
+ Coverage   62.31%   62.65%   +0.34%     
==========================================
  Files          47       47              
  Lines        1799     1821      +22     
==========================================
+ Hits         1121     1141      +20     
- Misses        678      680       +2     
Files Coverage Δ
llamabot/bot/__init__.py 88.23% <ø> (-1.24%) ⬇️
tests/bot/test_imagebot.py 100.00% <100.00%> (ø)
tests/prompt_library/test_python_prompt_library.py 100.00% <100.00%> (ø)
llamabot/cli/configure.py 38.70% <75.00%> (+3.22%) ⬆️
llamabot/bot/imagebot.py 75.67% <42.85%> (-6.68%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

This commit refactors the ImageBot class in the imagebot.py file.
The filename generation logic, which was previously inside the ImageBot class,
has been extracted to a separate function named filename_bot.
This function takes an image prompt as input and returns a filename generated by the SimpleBot.
This change improves the modularity and readability of the code.
This commit updates the docstring for the filename_bot function in the imagebot.py file.
The updated docstring now includes parameter and return value descriptions,
providing more detailed information about the function's usage and output.
This commit introduces a new test for the ImageBot class in the llamabot library.
The test checks the behavior of the call method
when it is invoked outside of a Jupyter notebook and no save path is provided.
The test ensures that the method correctly saves the image to a generated filename based on the prompt.
This commit removes the deadline for the test_codebot_instance function
in the python_prompt_library test suite to prevent potential timeout issues.
@ericmjl ericmjl merged commit 1e7badf into main Nov 11, 2023
6 checks passed
@ericmjl ericmjl deleted the update-openai branch November 11, 2023 16:42
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