|  | 
| 1 | 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | 
| 2 | 2 | 
 | 
| 3 | 3 | import { APIResource } from '../core/resource'; | 
|  | 4 | +import * as Shared from './shared'; | 
| 4 | 5 | import { APIPromise } from '../core/api-promise'; | 
| 5 | 6 | import { RequestOptions } from '../internal/request-options'; | 
| 6 |  | -import { path } from '../internal/utils/path'; | 
| 7 | 7 | 
 | 
| 8 | 8 | export class Models extends APIResource { | 
| 9 | 9 |   /** | 
| 10 |  | -   * Retrieves a model instance, providing basic information about the model such as | 
| 11 |  | -   * the owner and permissioning. | 
|  | 10 | +   * To list all models, send a GET request to `/v2/gen-ai/models`. | 
| 12 | 11 |    */ | 
| 13 |  | -  retrieve(model: string, options?: RequestOptions): APIPromise<Model> { | 
| 14 |  | -    return this._client.get(path`/models/${model}`, { | 
| 15 |  | -      defaultBaseURL: 'https://inference.do-ai.run/v1', | 
|  | 12 | +  list( | 
|  | 13 | +    query: ModelListParams | null | undefined = {}, | 
|  | 14 | +    options?: RequestOptions, | 
|  | 15 | +  ): APIPromise<ModelListResponse> { | 
|  | 16 | +    return this._client.get('/v2/gen-ai/models', { | 
|  | 17 | +      query, | 
|  | 18 | +      defaultBaseURL: 'https://api.digitalocean.com', | 
| 16 | 19 |       ...options, | 
| 17 | 20 |     }); | 
| 18 | 21 |   } | 
| 19 |  | - | 
| 20 |  | -  /** | 
| 21 |  | -   * Lists the currently available models, and provides basic information about each | 
| 22 |  | -   * one such as the owner and availability. | 
| 23 |  | -   */ | 
| 24 |  | -  list(options?: RequestOptions): APIPromise<ModelListResponse> { | 
| 25 |  | -    return this._client.get('/models', { defaultBaseURL: 'https://inference.do-ai.run/v1', ...options }); | 
| 26 |  | -  } | 
| 27 | 22 | } | 
| 28 | 23 | 
 | 
| 29 | 24 | export interface APIAgreement { | 
| @@ -66,43 +61,59 @@ export interface APIModelVersion { | 
| 66 | 61 |   patch?: number; | 
| 67 | 62 | } | 
| 68 | 63 | 
 | 
| 69 |  | -/** | 
| 70 |  | - * Describes a model offering that can be used with the API. | 
| 71 |  | - */ | 
| 72 |  | -export interface Model { | 
|  | 64 | +export interface ModelListResponse { | 
|  | 65 | +  links?: Shared.APILinks; | 
|  | 66 | + | 
|  | 67 | +  meta?: Shared.APIMeta; | 
|  | 68 | + | 
|  | 69 | +  models?: Array<APIModel>; | 
|  | 70 | +} | 
|  | 71 | + | 
|  | 72 | +export interface ModelListParams { | 
| 73 | 73 |   /** | 
| 74 |  | -   * The model identifier, which can be referenced in the API endpoints. | 
|  | 74 | +   * page number. | 
| 75 | 75 |    */ | 
| 76 |  | -  id: string; | 
|  | 76 | +  page?: number; | 
| 77 | 77 | 
 | 
| 78 | 78 |   /** | 
| 79 |  | -   * The Unix timestamp (in seconds) when the model was created. | 
|  | 79 | +   * items per page. | 
| 80 | 80 |    */ | 
| 81 |  | -  created: number; | 
|  | 81 | +  per_page?: number; | 
| 82 | 82 | 
 | 
| 83 | 83 |   /** | 
| 84 |  | -   * The object type, which is always "model". | 
|  | 84 | +   * only include models that are publicly available. | 
| 85 | 85 |    */ | 
| 86 |  | -  object: 'model'; | 
|  | 86 | +  public_only?: boolean; | 
| 87 | 87 | 
 | 
| 88 | 88 |   /** | 
| 89 |  | -   * The organization that owns the model. | 
|  | 89 | +   * include only models defined for the listed usecases. | 
|  | 90 | +   * | 
|  | 91 | +   * - MODEL_USECASE_UNKNOWN: The use case of the model is unknown | 
|  | 92 | +   * - MODEL_USECASE_AGENT: The model maybe used in an agent | 
|  | 93 | +   * - MODEL_USECASE_FINETUNED: The model maybe used for fine tuning | 
|  | 94 | +   * - MODEL_USECASE_KNOWLEDGEBASE: The model maybe used for knowledge bases | 
|  | 95 | +   *   (embedding models) | 
|  | 96 | +   * - MODEL_USECASE_GUARDRAIL: The model maybe used for guardrails | 
|  | 97 | +   * - MODEL_USECASE_REASONING: The model usecase for reasoning | 
|  | 98 | +   * - MODEL_USECASE_SERVERLESS: The model usecase for serverless inference | 
| 90 | 99 |    */ | 
| 91 |  | -  owned_by: string; | 
| 92 |  | -} | 
| 93 |  | - | 
| 94 |  | -export interface ModelListResponse { | 
| 95 |  | -  data: Array<Model>; | 
| 96 |  | - | 
| 97 |  | -  object: 'list'; | 
|  | 100 | +  usecases?: Array< | 
|  | 101 | +    | 'MODEL_USECASE_UNKNOWN' | 
|  | 102 | +    | 'MODEL_USECASE_AGENT' | 
|  | 103 | +    | 'MODEL_USECASE_FINETUNED' | 
|  | 104 | +    | 'MODEL_USECASE_KNOWLEDGEBASE' | 
|  | 105 | +    | 'MODEL_USECASE_GUARDRAIL' | 
|  | 106 | +    | 'MODEL_USECASE_REASONING' | 
|  | 107 | +    | 'MODEL_USECASE_SERVERLESS' | 
|  | 108 | +  >; | 
| 98 | 109 | } | 
| 99 | 110 | 
 | 
| 100 | 111 | export declare namespace Models { | 
| 101 | 112 |   export { | 
| 102 | 113 |     type APIAgreement as APIAgreement, | 
| 103 | 114 |     type APIModel as APIModel, | 
| 104 | 115 |     type APIModelVersion as APIModelVersion, | 
| 105 |  | -    type Model as Model, | 
| 106 | 116 |     type ModelListResponse as ModelListResponse, | 
|  | 117 | +    type ModelListParams as ModelListParams, | 
| 107 | 118 |   }; | 
| 108 | 119 | } | 
0 commit comments