模型注册表#

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-instructllmopenai与 text-davinci-003 具有类似的功能,但兼容旧版 Completions 端点,而不是 Chat Completions。
gpt-3.5-turbo-0613聊天openai2023 年 6 月 13 日的 GPT-3.5-turbo 的旧版快照。将在 2024 年 6 月 13 日弃用。
gpt-3.5-turbo-16k-0613聊天openai2023 年 6 月 13 日的 GPT-3.5-16k-turbo 的旧版快照。将在 2024 年 6 月 13 日弃用。
gpt-3.5-turbo-0301聊天openai2023 年 3 月 1 日的 GPT-3.5-turbo 的旧版快照。将在 2024 年 6 月 13 日弃用。
text-davinci-003llmopenai旧版 能够执行语言任务,质量和一致性优于 curie、babbage 或 ada 模型。将在 2024 年 1 月 4 日弃用。
text-davinci-002llmopenai旧版 与 text-davinci-003 具有类似的功能,但使用监督微调而不是强化学习进行训练。将在 2024 年 1 月 4 日弃用。
code-davinci-002llmopenai旧版 针对代码完成任务进行了优化。将在 2024 年 1 月 4 日弃用。
gpt-4-1106-preview聊天openaiGPT-4 TurboNew - 最新版本的 GPT-4 模型,具有改进的指令遵循、JSON 模式、可复现的输出、并行函数调用等等。返回最多 4,096 个输出 token。此预览模型目前不适合生产流量。
gpt-4-0613聊天openai2023 年 6 月 13 日的 GPT-4 快照,具有改进的函数调用支持。
gpt-4-32k-0613聊天openai2023 年 6 月 13 日的 GPT-4-32k 快照,具有改进的函数调用支持。
gpt-4-0314聊天openai2023 年 3 月 14 日的 GPT-4 快照,具有函数调用支持。此模型版本将在 2024 年 6 月 13 日弃用。
gpt-4-32k-0314聊天openai2023 年 3 月 14 日的 GPT-4-32k 快照,具有函数调用支持。此模型版本将在 2024 年 6 月 13 日弃用。
llama-v2-7b-chat-fw聊天fireworks70 亿参数 LlamaChat 模型
llama-v2-13b-chat-fw聊天fireworks130 亿参数 LlamaChat 模型
llama-v2-70b-chat-fw聊天fireworks700 亿参数 LlamaChat 模型
mixtral-8x7b-fw-chat聊天fireworks8x70 亿参数混合专家 Mistral 模型,适用于聊天
mixtral-8x7b-fw-llmllmfireworks8x70 亿参数混合专家 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聊天fireworks70 亿参数 LlamaChat 模型
llama-v2-13b-chat-fw聊天fireworks130 亿参数 LlamaChat 模型
llama-v2-70b-chat-fw聊天fireworks700 亿参数 LlamaChat 模型
mixtral-8x7b-fw-chat聊天fireworks8x70 亿参数混合专家 Mistral 模型,适用于聊天
mixtral-8x7b-fw-llmllmfireworks8x70 亿参数混合专家 Mistral 模型