-
Notifications
You must be signed in to change notification settings - Fork 588
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
chore(wren-ai-service): allow adding alias to llm #1276
Conversation
WalkthroughThe changes modify how model identifiers are built within the llm_processor and embedder_processor functions in the wren-ai-service. The updated code now attempts to use an alias from the model if available, defaulting to the original model name if not. This adjustment applies to both processors, ensuring that an alias is seamlessly integrated into the identifier construction process. Changes
Sequence Diagram(s)sequenceDiagram
participant P as Processor
participant E as Entry Data
participant M as Model Data
P->>E: Retrieve provider information
P->>M: Retrieve model details (alias & model name)
alt Alias exists
M-->>P: Return alias value
else No alias
M-->>P: Return model name
end
P->>P: Construct identifier "provider.alias/model"
Poem
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
wren-ai-service/src/providers/__init__.py (3)
26-57
: Update docstring to document the alias feature.The docstring examples should be updated to include the new alias feature. Consider adding an example that demonstrates how aliases are handled in both the input and output formats.
Example addition to the input format:
{ "type": "llm", "provider": "openai_llm", "models": [ { "model": "gpt-4o-mini", + "alias": "gpt4-mini", # Optional alias for the model "kwargs": { "temperature": 0, "n": 1, "max_tokens": 4096, "response_format": {"type": "json_object"} } } ], "api_base": "https://api.openai.com/v1" }
92-111
: Update docstring to document the alias feature.The docstring examples should be updated to include the new alias feature. Consider adding an example that demonstrates how aliases are handled in both the input and output formats.
Example addition to the input format:
{ "type": "embedder", "provider": "openai_embedder", "models": [ { "model": "text-embedding-ada-002", + "alias": "ada2", # Optional alias for the model "dimension": 1536 } ] }
223-245
: Update pipeline configuration example to demonstrate alias usage.The pipeline configuration example should be updated to show that aliases can be used in the identifiers.
Example update:
{ "type": "pipeline", "pipes": [ { "name": "indexing", - "llm": "openai_llm.gpt-4o-mini", - "embedder": "openai_embedder.text-embedding-3-large", + "llm": "openai_llm.gpt4-mini", # Using alias instead of model name + "embedder": "openai_embedder.ada2", # Using alias instead of model name "document_store": "qdrant", "engine": "wren_ui" } ] }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
wren-ai-service/src/providers/__init__.py
(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (5)
- GitHub Check: pytest
- GitHub Check: pytest
- GitHub Check: Analyze (python)
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: Analyze (go)
🔇 Additional comments (2)
wren-ai-service/src/providers/__init__.py (2)
71-71
: LGTM! Safe implementation of the alias feature.The change safely implements the alias feature while maintaining backward compatibility by using the Python dict.get() method with a default value.
125-125
: LGTM! Consistent implementation of the alias feature.The change maintains consistency with the
llm_processor
implementation and safely handles the alias feature.
Summary by CodeRabbit