Skip to content
This repository was archived by the owner on Oct 6, 2025. It is now read-only.

Comments

Allow run from a model ID#30

Merged
doringeman merged 5 commits intodocker:mainfrom
glours:allow-run-from-id
Apr 23, 2025
Merged

Allow run from a model ID#30
doringeman merged 5 commits intodocker:mainfrom
glours:allow-run-from-id

Conversation

@glours
Copy link
Contributor

@glours glours commented Apr 17, 2025

Added the capability to run a model from its ID
Splited Client.List function to apply separation of concerns:

  • List only return an array of Models
  • Add ListOpenAI to get an array of OpenAIModel
  • Introduce an Inspect function to get the detail of one Model
  • Add InspectOpenAI function to get the detail of one OpenAIModel
  • Remove the formatting from the Client and moved it the the CLI commands
  • Add a new install make task which build & link the binary at once

@glours glours force-pushed the allow-run-from-id branch from cd5bc49 to 83d5204 Compare April 18, 2025 08:24
glours added 4 commits April 23, 2025 10:24
add a dedicated function Inspect to Desktop Client which return a Model struct, used it in run command

Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
@glours glours force-pushed the allow-run-from-id branch from 83d5204 to faf86f8 Compare April 23, 2025 08:43
Copy link
Collaborator

@doringeman doringeman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you!

return c
}

func inpsectModel(args []string, openai bool, desktopClient *desktop.Client) (string, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
func inpsectModel(args []string, openai bool, desktopClient *desktop.Client) (string, error) {
func inspectModel(args []string, openai bool, desktopClient *desktop.Client) (string, error) {

RunE: func(cmd *cobra.Command, args []string) error {
model := args[0]
model, err := desktopClient.List(false, openai, false, model)
inspectedModel, err := inpsectModel(args, openai, desktopClient)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
inspectedModel, err := inpsectModel(args, openai, desktopClient)
inspectedModel, err := inspectModel(args, openai, desktopClient)

Comment on lines 232 to 233
if model, err = c.fullModelID(model); err != nil {
return Model{}, fmt.Errorf("invalid model name: %s", model)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if model, err = c.fullModelID(model); err != nil {
return Model{}, fmt.Errorf("invalid model name: %s", model)
receivedModel := model
if model, err = c.fullModelID(model); err != nil {
return Model{}, fmt.Errorf("invalid model name: %s", receivedModel)

Otherwise I won't see the received/queried model in the error:

$ docker model run 436bb
Failed to list models: invalid model name:

@glours glours force-pushed the allow-run-from-id branch from 1d11ab0 to 39287c7 Compare April 23, 2025 09:15
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
@glours glours force-pushed the allow-run-from-id branch from 39287c7 to 8a0af40 Compare April 23, 2025 09:17
@doringeman doringeman merged commit 3360d00 into docker:main Apr 23, 2025
1 check passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants