Flexible model client#163
Open
ivanleomk wants to merge 3 commits into
Open
Conversation
Deploying kura with
|
| Latest commit: |
6b8584f
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://1ebf4b22.kura-4ma.pages.dev |
| Branch Preview URL: | https://flexible-model-client.kura-4ma.pages.dev |
| self.model = model | ||
| # Handle both string model names and instructor client instances | ||
| if isinstance(model, str): | ||
| self.client = instructor.from_provider(model, async_client=True) |
Contributor
There was a problem hiding this comment.
Runtime error: 'instructor' is referenced in init but only imported inside a TYPE_CHECKING block. Import it at runtime (e.g. add a local import) to avoid NameError.
| # Handle both string model names and instructor client instances | ||
| if isinstance(model, str): | ||
| self.client = instructor.from_provider(model, async_client=True) | ||
| if isinstance(model, instructor.AsyncInstructor): |
Contributor
There was a problem hiding this comment.
Conditional logic bug: Use 'elif' instead of a second 'if' when checking for instructor.AsyncInstructor, so valid string models don’t trigger the else block.
Suggested change
| if isinstance(model, instructor.AsyncInstructor): | |
| elif isinstance(model, instructor.AsyncInstructor): |
|
If we pass the Gemini model, it is failing because the temperature is passing directly to |
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 makes it possible to either use a model string or just override and pass in an instructor client directly. This helps deal with cases where people might need to manually override the client
Important
Enhance model client flexibility by allowing
ClusterDescriptionModel,MetaClusterModel, andSummaryModelto accept either a model string or aninstructor.AsyncInstructorclient.ClusterDescriptionModel,MetaClusterModel, andSummaryModelnow accept either a model string or aninstructor.AsyncInstructorclient.ValueErrorif the model type is neither a string nor anAsyncInstructor.cluster.py,meta_cluster.py, andsummarisation.py, the__init__methods are updated to handle both string model names and instructor client instances.instructorwithin the__init__methods to ensure availability when needed.clientinstead ofmodelin initialization logs across the three files.This description was created by
for 6b8584f. You can customize this summary. It will automatically update as commits are pushed.