模型注册表#
LangChain 基准测试包含一个模型注册表,以更轻松地在不同模型之间运行基准测试。
如果您看到想要使用的模型但它缺失,请打开一个 PR 添加它!
from langchain_benchmarks import model_registry
model_registry
名称 | 类型 | 提供者 | 描述 |
---|---|---|---|
gpt-3.5-turbo-1106 | 聊天 | openai | 最新的 GPT-3.5 Turbo 模型,具有改进的指令遵循、JSON 模式、可复现的输出、并行函数调用等等。返回最多 4,096 个输出 token。 |
gpt-3.5-turbo | 聊天 | openai | 目前指向 gpt-3.5-turbo-0613。 |
gpt-3.5-turbo-16k | 聊天 | openai | 目前指向 gpt-3.5-turbo-0613。 |
gpt-3.5-turbo-instruct | llm | openai | 与 text-davinci-003 具有类似的功能,但兼容旧版 Completions 端点,而不是 Chat Completions。 |
gpt-3.5-turbo-0613 | 聊天 | openai | 2023 年 6 月 13 日的 GPT-3.5-turbo 的旧版快照。将在 2024 年 6 月 13 日弃用。 |
gpt-3.5-turbo-16k-0613 | 聊天 | openai | 2023 年 6 月 13 日的 GPT-3.5-16k-turbo 的旧版快照。将在 2024 年 6 月 13 日弃用。 |
gpt-3.5-turbo-0301 | 聊天 | openai | 2023 年 3 月 1 日的 GPT-3.5-turbo 的旧版快照。将在 2024 年 6 月 13 日弃用。 |
text-davinci-003 | llm | openai | 旧版 能够执行语言任务,质量和一致性优于 curie、babbage 或 ada 模型。将在 2024 年 1 月 4 日弃用。 |
text-davinci-002 | llm | openai | 旧版 与 text-davinci-003 具有类似的功能,但使用监督微调而不是强化学习进行训练。将在 2024 年 1 月 4 日弃用。 |
code-davinci-002 | llm | openai | 旧版 针对代码完成任务进行了优化。将在 2024 年 1 月 4 日弃用。 |
gpt-4-1106-preview | 聊天 | openai | GPT-4 TurboNew - 最新版本的 GPT-4 模型,具有改进的指令遵循、JSON 模式、可复现的输出、并行函数调用等等。返回最多 4,096 个输出 token。此预览模型目前不适合生产流量。 |
gpt-4-0613 | 聊天 | openai | 2023 年 6 月 13 日的 GPT-4 快照,具有改进的函数调用支持。 |
gpt-4-32k-0613 | 聊天 | openai | 2023 年 6 月 13 日的 GPT-4-32k 快照,具有改进的函数调用支持。 |
gpt-4-0314 | 聊天 | openai | 2023 年 3 月 14 日的 GPT-4 快照,具有函数调用支持。此模型版本将在 2024 年 6 月 13 日弃用。 |
gpt-4-32k-0314 | 聊天 | openai | 2023 年 3 月 14 日的 GPT-4-32k 快照,具有函数调用支持。此模型版本将在 2024 年 6 月 13 日弃用。 |
llama-v2-7b-chat-fw | 聊天 | fireworks | 70 亿参数 LlamaChat 模型 |
llama-v2-13b-chat-fw | 聊天 | fireworks | 130 亿参数 LlamaChat 模型 |
llama-v2-70b-chat-fw | 聊天 | fireworks | 700 亿参数 LlamaChat 模型 |
mixtral-8x7b-fw-chat | 聊天 | fireworks | 8x70 亿参数混合专家 Mistral 模型,适用于聊天 |
mixtral-8x7b-fw-llm | llm | fireworks | 8x70 亿参数混合专家 Mistral 模型 |
claude-2 | 聊天 | anthropic | 在需要复杂推理的任务上表现出色 |
claude-2.1 | 聊天 | anthropic | 与 Claude 2 性能相同,但显着降低了模型幻觉率 |
claude-instant-1.2 | 聊天 | anthropic | 低延迟、高吞吐量。 |
claude-instant-1 | 聊天 | anthropic | 低延迟、高吞吐量。 |
索引#
注册表支持按位置索引。此排序可能会随着更多模型的添加而更改。
registered_model = model_registry[0]
registered_model
名称 | gpt-3.5-turbo-1106 |
类型 | 聊天 |
提供者 | openai |
描述 | 最新的 GPT-3.5 Turbo 模型,具有改进的指令遵循、JSON 模式、可复现的输出、并行函数调用等等。返回最多 4,096 个输出 token。 |
模型路径 | langchain.chat_models.openai.ChatOpenAI |
URL | 模型页面 |
还可以按模型名称索引
model_registry["gpt-3.5-turbo"]
名称 | gpt-3.5-turbo |
类型 | 聊天 |
提供者 | openai |
描述 | 目前指向 gpt-3.5-turbo-0613。 |
模型路径 | langchain.chat_models.openai.ChatOpenAI |
URL | 模型页面 |
使用模型#
要使用模型,请确保已设置凭据。大多数模型在初始化器中使用 API 密钥或使用可能存在的任何 ENV 变量。
model = model_registry["gpt-3.5-turbo"].get_model(model_params={"temperature": 0})
model.invoke("hello! what is your name?")
AIMessage(content="Hello! I am an AI language model developed by OpenAI, and I don't have a personal name. You can simply refer to me as OpenAI Assistant. How can I assist you today?")
model = model_registry["claude-2.1"].get_model()
model.invoke("hello! what is your name?")
AIMessage(content=' Hello! My name is Claude.')
迭代#
for registered_model in model_registry:
print("-")
print(registered_model.name)
try:
model = registered_model.get_model()
result = model.invoke("What is your name?")
if isinstance(result, str):
print(result[:100])
else: # chat message
print(result.content[:100])
except Exception as e:
print(
f"Failed: {repr(e)[:200]}"
) # Fails if account does not have access to particular model or due to network limits etc
-
gpt-3.5-turbo-1106
I am a language model AI created by OpenAI and do not have a personal name. You can call me OpenAI.
-
gpt-3.5-turbo
I am an AI language model created by OpenAI, so I don't have a personal name. You can simply refer t
-
gpt-3.5-turbo-16k
I am an AI language model developed by OpenAI, and I do not have a personal name. You can simply ref
-
gpt-3.5-turbo-instruct
I am an AI digital assistant and do not have a name. You can call me OpenAI. What can I assist you
-
gpt-3.5-turbo-0613
I am an AI language model developed by OpenAI and I don't have a personal name. You can call me Open
-
gpt-3.5-turbo-16k-0613
I am an artificial intelligence created by OpenAI, so I don't have a personal name. You can refer to
-
gpt-3.5-turbo-0301
As an AI language model, I do not have a personal name. You can call me OpenAI or simply AI.
-
text-davinci-003
My name is Rebecca.
-
text-davinci-002
My name is Sarah.
-
code-davinci-002
Failed: InvalidRequestError(message='The model `code-davinci-002` does not exist or you do not have access to it.', param=None, code='model_not_found', http_status=404, request_id=None)
-
gpt-4-1106-preview
I am an AI developed by OpenAI, so I don't have a personal name. However, you can refer to me as Cha
-
gpt-4-0613
I am an artificial intelligence and do not have a personal name. I am often referred to as OpenAI.
-
gpt-4-32k-0613
Failed: InvalidRequestError(message='The model `gpt-4-32k-0613` does not exist or you do not have access to it. Learn more: https://help.openai.com/en/articles/7102672-how-can-i-access-gpt-4.', param=None, co
-
gpt-4-0314
I am an AI language model, so I don't have a personal name. You can call me OpenAI Assistant if you'
-
gpt-4-32k-0314
Failed: InvalidRequestError(message='The model `gpt-4-32k-0314` does not exist or you do not have access to it. Learn more: https://help.openai.com/en/articles/7102672-how-can-i-access-gpt-4.', param=None, co
-
llama-v2-7b-chat-fw
Hello! My name is Assistant, and I'm here to help you with any questions or concerns you may have. I
-
llama-v2-13b-chat-fw
Hello! My name is LLaMA, I'm a helpful and respectful assistant developed by Meta AI. I'm here to as
-
llama-v2-70b-chat-fw
Hello! My name is Assistant, and I'm here to help you with any questions or concerns you may have. I
-
mixtral-8x7b-fw-chat
My name is Mistral 7B with 8 Experts MoE model. I am a large language model created by Mistral.ai an
-
mixtral-8x7b-fw-llm
Where are you from?
I was born in Los Angeles, but grew up in Phoenix, Arizona. I moved back to L
-
claude-2
My name is Claude.
-
claude-2.1
My name is Claude.
-
claude-instant-1.2
My name is Claude.
-
claude-instant-1
My name is Claude.
切片#
切片符号
model_registry[:3]
名称 | 类型 | 提供者 | 描述 |
---|---|---|---|
gpt-3.5-turbo-1106 | 聊天 | openai | 最新的 GPT-3.5 Turbo 模型,具有改进的指令遵循、JSON 模式、可复现的输出、并行函数调用等等。返回最多 4,096 个输出 token。 |
gpt-3.5-turbo | 聊天 | openai | 目前指向 gpt-3.5-turbo-0613。 |
gpt-3.5-turbo-16k | 聊天 | openai | 目前指向 gpt-3.5-turbo-0613。 |
过滤#
过滤
model_registry.filter(provider="fireworks")
名称 | 类型 | 提供者 | 描述 |
---|---|---|---|
llama-v2-7b-chat-fw | 聊天 | fireworks | 70 亿参数 LlamaChat 模型 |
llama-v2-13b-chat-fw | 聊天 | fireworks | 130 亿参数 LlamaChat 模型 |
llama-v2-70b-chat-fw | 聊天 | fireworks | 700 亿参数 LlamaChat 模型 |
mixtral-8x7b-fw-chat | 聊天 | fireworks | 8x70 亿参数混合专家 Mistral 模型,适用于聊天 |
mixtral-8x7b-fw-llm | llm | fireworks | 8x70 亿参数混合专家 Mistral 模型 |