Skip to content

Home > llm-ops > LLM

LLM class

LLM类代表一个与LLM API进行交互的客户端。

Signature:

typescript
export declare class LLM
export declare class LLM

Constructors

ConstructorModifiersDescription
(constructor)(params)构造一个LLM客户端实例。

Properties

PropertyModifiersTypeDescription
cache?boolean(Optional)
choice_num?number | 1(Optional)
function_call?function_callType(Optional)
functions?functionsType(Optional)
llmllmType
messagesmessagesType
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)
tokensnumber
userstring

Methods

MethodModifiersDescription
chat(params)使用LLM进行聊天。
embedding(input)获取输入内容的嵌入向量。
exportHistory()导出历史消息。
log(args)static日志输出。
moderate(input)对输入内容进行审查。
printMessage(resMessages, reqMessages)打印消息。
recall()重复最后一次的聊天。

Released under the MIT License.