|
| 1 | +defmodule TrentoWeb.OpenApi.V1.Schema.AI do |
| 2 | + @moduledoc false |
| 3 | + |
| 4 | + require OpenApiSpex |
| 5 | + alias OpenApiSpex.Schema |
| 6 | + |
| 7 | + defmodule UserConfiguration do |
| 8 | + @moduledoc false |
| 9 | + |
| 10 | + OpenApiSpex.schema( |
| 11 | + %{ |
| 12 | + title: "AIUserConfigurationV1", |
| 13 | + description: "AI configuration for a user.", |
| 14 | + type: :object, |
| 15 | + nullable: true, |
| 16 | + additionalProperties: false, |
| 17 | + properties: %{ |
| 18 | + provider: %Schema{ |
| 19 | + type: :string, |
| 20 | + description: "Chosen AI provider.", |
| 21 | + example: "googleai", |
| 22 | + nullable: false |
| 23 | + }, |
| 24 | + model: %Schema{ |
| 25 | + type: :string, |
| 26 | + description: "Chosen AI model.", |
| 27 | + example: "gemini-2.0-flash", |
| 28 | + nullable: false |
| 29 | + } |
| 30 | + }, |
| 31 | + example: %{ |
| 32 | + provider: "googleai", |
| 33 | + model: "gemini-2.0-flash" |
| 34 | + }, |
| 35 | + required: [:provider, :model] |
| 36 | + }, |
| 37 | + struct?: false |
| 38 | + ) |
| 39 | + end |
| 40 | + |
| 41 | + defmodule CreateUserConfigurationRequest do |
| 42 | + @moduledoc false |
| 43 | + |
| 44 | + OpenApiSpex.schema( |
| 45 | + %{ |
| 46 | + title: "CreateUserConfigurationRequestV1", |
| 47 | + description: "AI configuration request for a user.", |
| 48 | + type: :object, |
| 49 | + additionalProperties: false, |
| 50 | + properties: %{ |
| 51 | + model: %Schema{ |
| 52 | + type: :string, |
| 53 | + description: "AI model.", |
| 54 | + nullable: false, |
| 55 | + example: "gemini-2.0-flash" |
| 56 | + }, |
| 57 | + api_key: %Schema{ |
| 58 | + type: :string, |
| 59 | + description: "AI API key.", |
| 60 | + nullable: false, |
| 61 | + example: "AIza..." |
| 62 | + } |
| 63 | + }, |
| 64 | + example: %{ |
| 65 | + model: "gemini-2.0-flash", |
| 66 | + api_key: "AIza..." |
| 67 | + }, |
| 68 | + required: [:model, :api_key] |
| 69 | + }, |
| 70 | + struct?: false |
| 71 | + ) |
| 72 | + end |
| 73 | + |
| 74 | + defmodule UpdateUserConfigurationRequest do |
| 75 | + @moduledoc false |
| 76 | + |
| 77 | + OpenApiSpex.schema( |
| 78 | + %{ |
| 79 | + title: "UpdateUserConfigurationRequestV1", |
| 80 | + description: "AI configuration request for a user.", |
| 81 | + type: :object, |
| 82 | + additionalProperties: false, |
| 83 | + minProperties: 1, |
| 84 | + properties: %{ |
| 85 | + model: %Schema{ |
| 86 | + type: :string, |
| 87 | + description: "AI model.", |
| 88 | + example: "gemini-2.0-flash" |
| 89 | + }, |
| 90 | + api_key: %Schema{ |
| 91 | + type: :string, |
| 92 | + description: "AI API key.", |
| 93 | + example: "AIza..." |
| 94 | + } |
| 95 | + }, |
| 96 | + example: %{ |
| 97 | + api_key: "AIza...", |
| 98 | + model: "gemini-2.0-flash" |
| 99 | + } |
| 100 | + }, |
| 101 | + struct?: false |
| 102 | + ) |
| 103 | + end |
| 104 | +end |
0 commit comments