-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feature/org name of model #49
Merged
Merged
Conversation
This file contains 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
- Import predefined model lists from `languru.types.models` for Anthropic, Google, Groq, Perplexity, and Voyage - Replace hardcoded `supported_models` with imported model lists - Update `GoogleModels` and `GroqModels` classes to include `supported_models` attribute - Add type ignores to resolve mypy issues in Groq client - Minor code style improvements and type annotations
- Split client initialization into separate methods for each provider - Replace static timestamp with dynamic creation time for models - Improve code organization and readability in OpenaiClients class - Maintain consistent model creation process across all providers
…class - Introduce OpenaiModels class for centralized model management - Refactor OpenaiClients to inherit from OpenaiModels - Add methods for adding and removing models dynamically - Enhance error handling in model retrieval - Update model initialization to use new management methods This refactoring improves code organization, flexibility, and maintainability of OpenAI model handling across different providers.
- openai_clients.py: - Rename OpenaiClients to inherit from OpenaiModels and new OpenaiDepends class - Add methods for stripping org from model name and detecting org type - Refactor org_from_model to use new helper methods - Move depends_org_type to OpenaiDepends class - organizations.py: - Enhance to_org_type function to handle OrganizationType input This refactoring improves code organization and adds flexibility in handling different organization types for OpenAI models.
- Add logging functionality to chat.py - Improve error handling for organization type - Enhance model name handling and strip organization prefix - Add debug logging for organization type, OpenAI client, and model - Fix typo in model name parsing in openai_clients.py - Add utility function for human-readable object representation This commit improves the robustness and debuggability of the chat completion functionality, making it easier to trace issues and understand the system's behavior.
- Add logging functionality across all API handlers for better debugging - Improve error handling for organization types and model selection - Refactor code to use common utility functions for consistency - Enhance handling of organization-specific model names - Affected files: completions.py, embeddings.py, images.py, moderations.py This update improves the robustness and maintainability of the API handlers in the languru server.
- Create new 'openapi' example module with chat completion requests - Refactor chat completion API to use new examples - Add utility function for OpenAPI example conversion
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #49 +/- ##
==========================================
+ Coverage 81.12% 81.65% +0.53%
==========================================
Files 64 65 +1
Lines 2215 2339 +124
==========================================
+ Hits 1797 1910 +113
- Misses 418 429 +11 ☔ View full report in Codecov by Sentry. |
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.
OpenAI Client Enhancements:
OpenaiClients
class to improve organization and modularity.OpenaiModels
andOpenaiDepends
classes to separate concerns.Model Management:
Organization Type Handling:
org_in_model_name
andorg_in_supported_models
methods for better organization type inference.Logging and Debugging:
display_object
function for better object representation in logs.API Endpoint Improvements:
OpenAPI Examples:
to_openapi_examples
for converting examples to the required format.Client Initialization:
Dependency Injection:
Code Structure and Organization:
Type Hinting and Documentation: