重要提示

您正在查看 NeMo 2.0 文档。此版本引入了 API 的重大更改和一个新库,NeMo Run。我们目前正在将 NeMo 1.0 中的所有功能移植到 2.0。有关先前版本或 2.0 中尚不可用的功能的文档,请参阅 NeMo 24.07 文档

LLM 服务#

class nemo_curator.LLMClient#

表示连接到 LLM 推理服务器并同步发出请求的客户端的接口

class nemo_curator.AsyncLLMClient#

表示连接到 LLM 推理服务器并异步发出请求的客户端的接口

class nemo_curator.OpenAIClient(openai_client: openai.OpenAI)#

OpenAI Python 客户端的封装器,用于查询模型

query_reward_model(
*,
messages: Iterable,
model: str,
) dict#

提示 LLM 奖励模型对用户和助手之间的对话进行评分 :param messages: 要计算分数的对话。

应格式化为

[{“role”: “user”, “content”: “写一个句子”}, {“role”: “assistant”, “content”: “这是一个句子”}, …]

参数:

model – 应该用于计算奖励的模型的名称。必须是奖励模型,不能是常规 LLM。

返回:

score_name -> score 的映射

class nemo_curator.AsyncOpenAIClient(async_openai_client: openai.AsyncOpenAI)#

OpenAI Python 异步客户端的封装器,用于查询模型

async query_reward_model(
*,
messages: Iterable,
model: str,
) dict#

提示 LLM 奖励模型对用户和助手之间的对话进行评分 :param messages: 要计算分数的对话。

应格式化为

[{“role”: “user”, “content”: “写一个句子”}, {“role”: “assistant”, “content”: “这是一个句子”}, …]

参数:

model – 应该用于计算奖励的模型的名称。必须是奖励模型,不能是常规 LLM。

返回:

score_name -> score 的映射

class nemo_curator.NemoDeployClient(nemo_deploy: NemoQueryLLM)#

NemoQueryLLM 的封装器,用于在合成数据生成中查询模型

query_reward_model(
*,
messages: Iterable,
model: str,
) dict#

提示 LLM 奖励模型对用户和助手之间的对话进行评分 :param messages: 要计算分数的对话。

应格式化为

[{“role”: “user”, “content”: “写一个句子”}, {“role”: “assistant”, “content”: “这是一个句子”}, …]

参数:

model – 应该用于计算奖励的模型的名称。必须是奖励模型,不能是常规 LLM。

返回:

score_name -> score 的映射