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

add SpiceClient #2

Merged
merged 3 commits into from
Mar 8, 2024
Merged

add SpiceClient #2

merged 3 commits into from
Mar 8, 2024

Conversation

biobootloader
Copy link
Member

No description provided.

else:
response = chat_completion_or_stream.choices[0].message.content
return response
raise ValueError(f"Unknown model {model}")
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider adding support for more models or a default model to avoid raising an exception for unknown models. This would make the client more flexible.

spice.py Outdated

load_dotenv()
Copy link
Contributor

Choose a reason for hiding this comment

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

It's a good practice to call load_dotenv() at the entry point of the application to ensure environment variables are loaded once and available throughout the application. Consider moving this call outside of the class.

Copy link
Member Author

Choose a reason for hiding this comment

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

good call

spice.py Outdated
else:
content = chunk.choices[0].delta.content
if content is not None:
yield content
Copy link
Contributor

Choose a reason for hiding this comment

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

The check for content is not None might be redundant since you're initializing content to an empty string and only changing it if certain conditions are met. Consider removing this check.

Copy link
Contributor

mentatbot bot commented Mar 8, 2024

MENTAT CODE REVIEW IN ACTIVE DEVELOPMENT. Only in use on mentat and internal repos.
Please Reply with feedback.

Overall, the implementation of the SpiceClient class is a good approach to abstracting the logic for interacting with different language models. However, there are a few areas for improvement, such as removing unused variables, handling potential exceptions, and reconsidering the necessity of certain checks. Additionally, consider the placement of load_dotenv() to ensure environment variables are loaded appropriately.

biobootloader and others added 2 commits March 7, 2024 23:27
Co-authored-by: abanteai-butler[bot] <160964065+abanteai-butler[bot]@users.noreply.github.com>
@biobootloader biobootloader merged commit 173f1fb into main Mar 8, 2024
2 checks 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.

1 participant