-
Notifications
You must be signed in to change notification settings - Fork 6
add ModelzClient.create_completion classmethod #24
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
base: main
Are you sure you want to change the base?
add ModelzClient.create_completion classmethod #24
Conversation
|
Has llmspec been published? I'll declare it as a dependency if yes. |
| ModelzResponse(resp) | ||
| console.print(f"created the build job for repo [bold cyan]{repo}[/bold cyan]") | ||
|
|
||
| @classmethod |
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.
Any reason to create the class method?
| try: | ||
| from llmspec import LLMSpec | ||
|
|
||
| # Instantiate LLMSpec and transform the prompt | ||
| llmspec = LLMSpec(prompt) | ||
| transformed_prompt = llmspec.to_model(model) | ||
| except ImportError as err: | ||
| raise ImportError( | ||
| "llmspec is required for LLM models" | ||
| "\nPlease install it with the command `pip install llmspec" | ||
| ) from err |
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.
Will publish it later.
| # Prepare request params | ||
| request_params = {"prompt": transformed_prompt} | ||
| if params: | ||
| request_params.update(params) | ||
|
|
||
| # Get the inference result | ||
| response = client.inference(request_params, deployment, serde) | ||
|
|
||
| return response |
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.
If so, why not use client.inference directly? Why do we need a new function?
add ModelzClient.create_completion classmethod that provides a similar interface to openai's: