Tailchat-Assistant/src/types.ts

82 lines
1.4 KiB
TypeScript
Raw Normal View History

2024-06-18 17:49:56 -04:00
import OpenAI from "openai";
2024-06-26 10:35:11 -04:00
import {
ChatCompletionMessage,
2024-06-26 10:35:11 -04:00
ChatCompletionUserMessageParam,
ChatCompletionSystemMessageParam,
2024-06-26 10:35:11 -04:00
} from "openai/resources";
2024-06-18 17:49:56 -04:00
import { TailchatWsClient } from "tailchat-client-sdk";
export interface ImageMessage {
2024-06-18 17:49:56 -04:00
role: "user";
content: [
{
type: "text";
text: string;
},
{
type: "image_url";
image_url: {
url: string;
};
},
];
}
export type Message =
| ChatCompletionMessage
| ChatCompletionUserMessageParam
| ChatCompletionSystemMessageParam;
2024-06-18 17:49:56 -04:00
export type validImgSize = "256x256" | "512x512" | "1024x1024";
2024-06-18 17:49:56 -04:00
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<Message | ImageMessage>;