feat: add v2 generate text endpoint (#34371)
This commit is contained in:
parent
7073e8797f
commit
595c6bd4a7
12 changed files with 462 additions and 233 deletions
|
|
@ -43,6 +43,8 @@ import type {
|
|||
MessagesListOutput,
|
||||
ModelsListInput,
|
||||
ModelsListOutput,
|
||||
GenerateTextInput,
|
||||
GenerateTextOutput,
|
||||
ProvidersListInput,
|
||||
ProvidersListOutput,
|
||||
ProvidersGetInput,
|
||||
|
|
@ -535,6 +537,21 @@ export function make(options: ClientOptions) {
|
|||
requestOptions,
|
||||
),
|
||||
},
|
||||
generate: {
|
||||
text: (input: GenerateTextInput, requestOptions?: RequestOptions) =>
|
||||
request<{ readonly data: GenerateTextOutput }>(
|
||||
{
|
||||
method: "POST",
|
||||
path: `/api/generate`,
|
||||
query: { location: input["location"] },
|
||||
body: { prompt: input["prompt"], model: input["model"] },
|
||||
successStatus: 200,
|
||||
declaredStatuses: [400, 503, 401],
|
||||
empty: false,
|
||||
},
|
||||
requestOptions,
|
||||
).then((value) => value.data),
|
||||
},
|
||||
providers: {
|
||||
list: (input?: ProvidersListInput, requestOptions?: RequestOptions) =>
|
||||
request<ProvidersListOutput>(
|
||||
|
|
|
|||
|
|
@ -2017,6 +2017,22 @@ export type ModelsListOutput = {
|
|||
}>
|
||||
}
|
||||
|
||||
export type GenerateTextInput = {
|
||||
readonly location?: {
|
||||
readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined
|
||||
}["location"]
|
||||
readonly prompt: {
|
||||
readonly prompt: string
|
||||
readonly model?: { readonly id: string; readonly providerID: string; readonly variant?: string } | null
|
||||
}["prompt"]
|
||||
readonly model?: {
|
||||
readonly prompt: string
|
||||
readonly model?: { readonly id: string; readonly providerID: string; readonly variant?: string } | null
|
||||
}["model"]
|
||||
}
|
||||
|
||||
export type GenerateTextOutput = { readonly data: { readonly text: string } }["data"]
|
||||
|
||||
export type ProvidersListInput = {
|
||||
readonly location?: {
|
||||
readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue