feat: add v2 generate text endpoint (#34371)

This commit is contained in:
Kit Langton 2026-06-28 22:43:58 -04:00 committed by GitHub
commit 595c6bd4a7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 462 additions and 233 deletions

View file

@ -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>(

View file

@ -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