feat: Implement LLM features using litellm#189
Draft
google-labs-jules[bot] wants to merge 1 commit intomainfrom
Draft
feat: Implement LLM features using litellm#189google-labs-jules[bot] wants to merge 1 commit intomainfrom
google-labs-jules[bot] wants to merge 1 commit intomainfrom
Conversation
This commit implements the LLM features that were previously added as placeholders. The implementation uses the `litellm` library to provide a provider-agnostic interface to various Large Language Models. The `openodia.llm.LLM` class now provides the following methods: - `summarize`: For abstractive text summarization. - `named_entity_recognition`: For Named Entity Recognition. - `sentiment_analysis`: For sentiment analysis. The implementation is configurable via environment variables: - `OPENODIA_LLM_MODEL`: To specify the LLM model to use (e.g., `gemini/gemini-pro`, `openai/gpt-4`). Defaults to `gemini/gemini-pro`. - API keys for the respective services are read from standard environment variables (`GEMINI_API_KEY`, `OPENAI_API_KEY`, etc.). The documentation has been updated to reflect these changes and provide usage examples. Unit tests have been added for the new features, using `unittest.mock` to patch the `litellm.completion` function and avoid actual API calls. The `litellm` library has been added as a dependency in `pyproject.toml`.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #189 +/- ##
==========================================
+ Coverage 99.49% 99.55% +0.06%
==========================================
Files 9 10 +1
Lines 199 227 +28
==========================================
+ Hits 198 226 +28
Misses 1 1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change implements the previously-defined placeholder methods for LLM features using the
litellmlibrary. This provides a provider-agnostic way to use different LLMs for summarization, NER, and sentiment analysis. The implementation is configurable via environment variables. Unit tests and documentation have been added.