llm_old/llm.ts
2024-10-02 14:09:54 +08:00

87 lines
2.3 KiB
TypeScript

// just for develop
{{range .}}
let {{.}}: LLM
{{- end}}
export default {
similarity,
{{- range .}}
{{.}},
{{- end}}
}
function similarity(a: any, b: any): number{return 0}
interface ChatConfig {
model: string
ratio: number
maxTokens: number
temperature: number
topP: number
tools: Object
}
interface ChatResult {
result: string
askTokens: number
answerTokens: number
totalTokens: number
usedTime: number
}
interface GCConfig {
model: string
size: string
ref: string
}
interface GCResult {
result: string
preview: string
results: Array<string>
previews: Array<string>
usedTime: number
}
interface EmbeddingResult {
result: string
askTokens: number
answerTokens: number
totalTokens: number
usedTime: number
}
interface Support {
ask: boolean
askWithImage: boolean
askWithVideo: boolean
askWithCodeInterpreter: boolean
askWithWebSearch: boolean
makeImage: boolean
makeVideo: boolean
models: Array<string>
}
interface LLM {
ask(messages: any, config?: ChatConfig, callback?: (answer: string) => void): ChatResult
fastAsk(messages: any, callback?: (answer: string) => void): ChatResult
longAsk(messages: any, callback?: (answer: string) => void): ChatResult
batterAsk(messages: any, callback?: (answer: string) => void): ChatResult
bestAsk(messages: any, callback?: (answer: string) => void): ChatResult
multiAsk(messages: any, callback?: (answer: string) => void): ChatResult
bestMultiAsk(messages: any, callback?: (answer: string) => void): ChatResult
codeInterpreterAsk(messages: any, callback?: (answer: string) => void): ChatResult
webSearchAsk(messages: any, callback?: (answer: string) => void): ChatResult
makeImage(prompt: string, config?: GCConfig): GCResult
fastMakeImage(prompt: string, config?: GCConfig): GCResult
bestMakeImage(prompt: string, config?: GCConfig): GCResult
makeVideo(prompt: string, config?: GCConfig): GCResult
fastMakeVideo(prompt: string, config?: GCConfig): GCResult
bestMakeVideo(prompt: string, config?: GCConfig): GCResult
embedding(text: string, model: string): EmbeddingResult
fastEmbedding(text: string): EmbeddingResult
bestEmbedding(text: string): EmbeddingResult
support: Support
}