LLM class
LLM类代表一个与LLM API进行交互的客户端。
Signature:
typescript
export declare class LLMexport declare class LLMConstructors
| Constructor | Modifiers | Description |
|---|---|---|
| (constructor)(params) | 构造一个LLM客户端实例。 |
Properties
| Property | Modifiers | Type | Description |
|---|---|---|---|
| cache? | boolean | (Optional) | |
| choice_num? | number | 1 | (Optional) | |
| function_call? | function_callType | (Optional) | |
| functions? | functionsType | (Optional) | |
| llm | llmType | ||
| messages | messagesType | ||
| modelName? | (string & object) | "gpt-4" | "gpt-4-0314" | "gpt-4-0613" | "gpt-4-32k" | "gpt-4-32k-0314" | "gpt-4-32k-0613" | "gpt-3.5-turbo" | "gpt-3.5-turbo-16k" | "gpt-3.5-turbo-0301" | "gpt-3.5-turbo-0613" | "gpt-3.5-turbo-16k-0613" | (Optional) | |
| roleToColor | { system: string; user: string; assistant: string; function: string; } | ||
| stop? | string | null | string[] | (Optional) | |
| temperature? | number | (Optional) | |
| tokens | number | ||
| user | string |
Methods
| Method | Modifiers | Description |
|---|---|---|
| chat(params) | 使用LLM进行聊天。 | |
| embedding(input) | 获取输入内容的嵌入向量。 | |
| exportHistory() | 导出历史消息。 | |
| log(args) | static | 日志输出。 |
| moderate(input) | 对输入内容进行审查。 | |
| printMessage(resMessages, reqMessages) | 打印消息。 | |
| recall() | 重复最后一次的聊天。 |