instantmodel.go 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. package llm
  2. import (
  3. "yunion.io/x/jsonutils"
  4. api "yunion.io/x/onecloud/pkg/apis/llm"
  5. "yunion.io/x/onecloud/pkg/mcclient/options"
  6. )
  7. type LLMInstantModelListOptions struct {
  8. options.BaseListOptions
  9. ModelName []string `help:"filter by model name"`
  10. ModelTag []string `help:"filter by model tag"`
  11. }
  12. func (o *LLMInstantModelListOptions) Params() (jsonutils.JSONObject, error) {
  13. return options.ListStructToParams(o)
  14. }
  15. type LLMInstantModelShowOptions struct {
  16. options.BaseShowOptions
  17. }
  18. func (o *LLMInstantModelShowOptions) Params() (jsonutils.JSONObject, error) {
  19. return options.StructToParams(o)
  20. }
  21. type LLMInstantModelCreateOptions struct {
  22. options.BaseCreateOptions
  23. LLM_TYPE string `help:"llm container type" choices:"ollama|vllm" json:"llm_type"`
  24. MODEL_NAME string `json:"model_name"`
  25. MODEL_TAG string `json:"model_tag"`
  26. ImageId string `json:"image_id"`
  27. Mounts []string `json:"mounts"`
  28. }
  29. func (o *LLMInstantModelCreateOptions) Params() (jsonutils.JSONObject, error) {
  30. return jsonutils.Marshal(o), nil
  31. }
  32. type LLMInstantModelUpdateOptions struct {
  33. options.BaseIdOptions
  34. ImageId string `json:"image_id"`
  35. Mounts []string `json:"mounts"`
  36. }
  37. func (o *LLMInstantModelUpdateOptions) Params() (jsonutils.JSONObject, error) {
  38. return jsonutils.Marshal(o), nil
  39. }
  40. type LLMInstantModelDeleteOptions struct {
  41. options.BaseIdOptions
  42. }
  43. func (o *LLMInstantModelDeleteOptions) Params() (jsonutils.JSONObject, error) {
  44. return options.StructToParams(o)
  45. }
  46. type LLMInstantModelImportOptions struct {
  47. LLM_TYPE string `help:"llm container type" choices:"ollama|vllm" json:"llm_type"`
  48. MODEL_NAME string `help:"model name to import, e.g. qwen3 or Qwen/Qwen3-VL-8B-Instruct" json:"model_name"`
  49. MODEL_TAG string `help:"model tag to import, e.g. 8b" json:"model_tag"`
  50. }
  51. func (o *LLMInstantModelImportOptions) Params() (jsonutils.JSONObject, error) {
  52. input := api.InstantModelImportInput{
  53. ModelName: o.MODEL_NAME,
  54. ModelTag: o.MODEL_TAG,
  55. LlmType: api.LLMContainerType(o.LLM_TYPE),
  56. }
  57. return jsonutils.Marshal(input), nil
  58. }
  59. type LLMInstantModelCommunityRegistryOptions struct {
  60. }
  61. func (o *LLMInstantModelCommunityRegistryOptions) Params() (jsonutils.JSONObject, error) {
  62. return nil, nil
  63. }
  64. func (o *LLMInstantModelCommunityRegistryOptions) Property() string {
  65. return "community-registry"
  66. }