Tailchat-Assistant/src/types.ts

76 lines
1.2 KiB
TypeScript
Raw Normal View History

2024-06-18 17:49:56 -04:00
import OpenAI from "openai";
import { ChatCompletionRole } from "openai/resources";
import { TailchatWsClient } from "tailchat-client-sdk";
interface ChatCompletion {
role: ChatCompletionRole;
content: string;
}
interface ImageUrl {
role: "user";
content: [
{
type: "text";
text: string;
},
{
type: "image_url";
image_url: {
url: string;
};
},
];
}
export type validImgSize = "256x256" | "512x512" | "1024x1024";
export type validImgAmount = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
export interface ImageRequestData {
model: Model;
prompt: string;
n?: validImgAmount;
size?: validImgSize;
}
export interface ImagePrompt {
client: TailchatWsClient;
assistant: OpenAI;
message: any;
prompt: string;
amount?: validImgAmount;
size?: validImgSize;
}
export type Model =
| "gpt-4"
| "gpt-4-vision-preview"
| "stablediffusion"
| "stablediffusion-cpp"
| "dall-e-3"
| "jina-reranker-v1-base-en"
| "text-embedding-ada-002";
export type Temperature =
| 0.1
| 0.2
| 0.3
| 0.4
| 0.5
| 0.6
| 0.7
| 0.8
| 0.9
| 1.0
| 1.1
| 1.2
| 1.3
| 1.4
| 1.5
| 1.6
| 1.7
| 1.8
| 1.9
| 2.0;
export type Messages = Array<ChatCompletion | ImageUrl>;