UNPKG

portkey-ai

Version:
167 lines (166 loc) 6.38 kB
import { APIResponseType, ApiClientInterface } from '../_types/generalTypes'; import { ModelParams } from '../_types/portkeyConstructs'; import { ApiResource } from '../apiResource'; import { APIPromise, RequestOptions } from '../baseClient'; import { Stream } from '../streaming'; export declare class Generations extends ApiResource { create(_body: GenerationsBody, opts?: RequestOptions): APIPromise<Generation>; } export interface GenerationsBody extends ModelParams { promptID: string; variables?: Record<string, any>; } export interface Generation extends APIResponseType { success: boolean; data: Record<string, any>; } export interface PromptBodyBase extends ModelParams { promptID?: string; variables?: Record<string, any>; } export interface PromptsCreateStreaming extends PromptBodyBase { stream?: true; } export interface PromptsCreateNonStreaming extends PromptBodyBase { stream?: false; } export interface Functions { name?: string; description?: string; parameters?: object; } export interface Tool { function?: Functions; type?: string; } export interface Messages { content?: string; role?: string; } export type PromptsCreateParams = PromptsCreateNonStreaming | PromptsCreateStreaming; type PromptsResponse = Record<string, any> & APIResponseType; type PromptRenderResponse = { success: boolean; data: { messages?: Messages[]; prompt?: string; model?: string; stream?: boolean; suffix?: string; max_tokens?: number; temperature?: number; top_k?: number; top_p?: number; n?: number; stop_sequences?: string[]; functions?: Functions[]; function_call?: string | Functions; logprobs?: boolean; top_logprobs?: number; echo?: boolean; stop?: string | string[]; presence_penalty?: number; frequency_penalty?: number; best_of?: number; logit_bias?: { [key: string]: number; }; user?: string; organization?: string; tool_choice?: string; tools?: Tool[]; response_format?: object; seed?: number; }; } & APIResponseType; export interface PromptsCreateBody { name: string; collection_id: string; string: string; parameters: object; virtual_key?: string; model?: string; functions?: any[]; tools?: any[]; tool_choice?: object; version_description?: string; template_metadata?: object; } export interface PromptsUpdateBody { name?: string; collection_id?: string; string?: string; parameters?: object; virtual_key?: string; model?: string; functions?: any[]; tools?: any[]; tool_choice?: object; version_description?: string; template_metadata?: object; } export interface PromptsListQuery { collection_id?: string; workspace_id?: string; current_page?: number; page_size?: number; search?: string; } export interface PromptsPartialsCreateBody { name: string; string: string; workspace_id?: string; version_description?: string; } export interface PromptsPartialUpdateBody { name?: string; string?: string; description?: string; status?: string; } export interface PromptsPartialsListQuery { collection_id?: string; } export declare class Prompt extends ApiResource { completions: PromptCompletions; versions: PromptVersions; partials: Partials; constructor(client: any); render(_body: PromptsCreateParams, params?: ApiClientInterface, opts?: RequestOptions): APIPromise<PromptRenderResponse>; create(_body: PromptsCreateBody, params?: ApiClientInterface, opts?: RequestOptions): APIPromise<PromptsResponse>; list(_query?: PromptsListQuery, params?: ApiClientInterface, opts?: RequestOptions): APIPromise<PromptsResponse>; retrieve(promptSlug: string, params?: ApiClientInterface, opts?: RequestOptions): APIPromise<PromptsResponse>; update(promptSlug: string, _body: PromptsUpdateBody, params?: ApiClientInterface, opts?: RequestOptions): APIPromise<PromptsResponse>; delete(promptSlug: string, params?: ApiClientInterface, opts?: RequestOptions): APIPromise<any>; publish(promptSlug: string, body: { version: number; }, params?: ApiClientInterface, opts?: RequestOptions): APIPromise<any>; } export declare class PromptVersions extends ApiResource { list(promptSlug: string, params?: ApiClientInterface, opts?: RequestOptions): APIPromise<any>; retrieve(promptSlug: string, versionId: string, params?: ApiClientInterface, opts?: RequestOptions): APIPromise<any>; update(promptSlug: string, versionId: string, body?: { label_id?: string; }, params?: ApiClientInterface, opts?: RequestOptions): APIPromise<any>; } export declare class Partials extends ApiResource { versions: PromptPartialsVersions; constructor(client: any); create(_body: PromptsPartialsCreateBody, params?: ApiClientInterface, opts?: RequestOptions): APIPromise<PromptsResponse>; list(_query?: PromptsPartialsListQuery, params?: ApiClientInterface, opts?: RequestOptions): APIPromise<any>; retrieve(promptPartialSlug: string, params?: ApiClientInterface, opts?: RequestOptions): APIPromise<any>; update(promptPartialSlug: string, body: PromptsPartialUpdateBody, params?: ApiClientInterface, opts?: RequestOptions): APIPromise<any>; delete(promptPartialSlug: string, params?: ApiClientInterface, opts?: RequestOptions): APIPromise<any>; publish(promptPartialSlug: string, body: { version: number; }, params?: ApiClientInterface, opts?: RequestOptions): APIPromise<any>; } export declare class PromptPartialsVersions extends ApiResource { list(promptPartialSlug: string, params?: ApiClientInterface, opts?: RequestOptions): APIPromise<any>; } export declare class PromptCompletions extends ApiResource { create(_body: PromptsCreateNonStreaming, params?: ApiClientInterface, opts?: RequestOptions): APIPromise<PromptsResponse>; create(_body: PromptsCreateStreaming, params?: ApiClientInterface, opts?: RequestOptions): APIPromise<Stream<PromptsResponse>>; create(_body: PromptsCreateParams, params?: ApiClientInterface, opts?: RequestOptions): APIPromise<Stream<PromptsResponse> | PromptsResponse>; } export {};