当前位置:   article > 正文

函数调用(function calling)_assistant api和function call

assistant api和function call

目录

入门例子

openai调用function calling

LangChain调用function calling

OpenAI Assistant API支持function calling

LangChain Assistant API支持function calling

网页Assistant支持function calling


函数调用(Function Calling)是OpenAI在今年6月13日对外发布的新能力。根据OpenAI官方博客描述,函数调用能力可以让大模型输出一个请求调用函数的消息,其中包含所需调用的函数信息、以及调用函数时所携带的参数信息。这是一种将大模型(LLM)能力与外部工具/API连接起来的新方式。

比如用户输入:

What’s the weather like in Tokyo?

使用function calling,可实现函数执行get_current_weather(location: string),从而获取函数输出,即得到对应地理位置的天气情况。这其中,location这个参数及其取值是借助大模型能力从用户输入中抽取出来的,同时,大模型判断得到调用的函数为get_current_weather

开发人员可以使用大模型的function calling能力实现:

  • • 在进行自然语言交流时,通过调用外部工具回答问题(类似于ChatGPT插件);

  • • 将自然语言转换为调用API调用,或数据库查询语句;

  • • 从文本中抽取结构化数据

  • • 其它

那么,在OpenAI发布的模型中,是如何实现function calling的呢?

本文中,使用的第三方模块信息如下:

  1. openai==1.3.2
  2. langchain==0.0.339

入门例子

我们以函数get_weather_info为例,其实现逻辑(模拟实现世界中的API调用,获取对应城市的天气状况)如下:

  1. def get_weather_info(city: str):
  2.     weather_info = {"Shanghai""Rainy""Beijing""Snow"}
  3.     return weather_info.get(city, "Sunny")

该函数只有一个参数:字符串变量city,即城市名称。为了实现function calling功能,需配置函数描述(类似JSON化的API描述),代码如下:

  1. functions = [
  2.     {
  3.         "name""get_weather_info",
  4.         "description""Get the weather information of a city",
  5.         "parameters": {
  6.             "type""object",
  7.             "properties": {
  8.                 "city": {
  9.                     "type""string",
  10.                     "description""The name of the city, e.g. Shanghai",
  11.                 },
  12.             },
  13.             "required": ["city"],
  14.         }
  15.     }
  16. ]

对于一般的用户输入(query),大模型回复结果如下:

  1. import json
  2. from openai import OpenAI
  3. client = OpenAI(api_key="sk-xxx")
  4. query = "What is the capital of france?"
  5. response = client.chat.completions.create(
  6.         model="gpt-3.5-turbo-0613",
  7.         messages=[{"role""user""content": query}],
  8.         functions=functions
  9.     )
  10. message = response.dict()["choices"][0]["message"]
  11. print(message)
  12. >>> {'content''The capital of France is Paris.''role''assistant''function_call'None'tool_calls'None}

此时function_call为None,即大模型判断不需要function calling.

对于查询天气的query,大模型输出结果如下:

  1. import json
  2. from openai import OpenAI
  3. client = OpenAI(api_key="sk-xxx")
  4. query = "What is the weather like in Beijing?"
  5. response = client.chat.completions.create(
  6.         model="gpt-3.5-turbo-0613",
  7.         messages=[{"role""user""content": query}],
  8.         functions=functions
  9.     )
  10. message = response.dict()["choices"][0]["message"]
  11. print(message)
  12. >>> {'content'None'role''assistant''function_call': {'arguments''{\n  "city": "Beijing"\n}''name''get_weather_info'}, 'tool_calls'None}

此时我们看到了令人吃惊的输出,大模型的输出内容为空,而判断需要function calling, 函数名称为get_weather_info,参数为{'arguments': '{\n "city": "Beijing"\n}

下一步,我们可以调用该函数,传入参数,得到函数输出,并再次调用大模型得到答案回复。

  1. func_name = message["function_call"]["name"]
  2. func_args = json.loads(message["function_call"]["arguments"])
  3. print("func name and args: ", func_name, func_args)
  4. func_response = get_weather_info(**func_args)
  5. final_response = client.chat.completions.create(
  6.                 model="gpt-3.5-turbo-0613",
  7.                 messages=[
  8.                     {"role""user""content": query},
  9.                     {"role""assistant""content"None"function_call": message["function_call"]},
  10.                     {
  11.                         "role""function",
  12.                         "name": func_name,
  13.                         "content": func_response
  14.                     },
  15.                 ],
  16.             )
  17. print("answer: ", final_response.dict()["choices"][0]["message"]["content"])

输出结果如下:

  1. func name and args:  get_weather_info {'city''Beijing'}
  2. answer:  The weather in Beijing is currently snowy.

以上仅是function calling的简单示例,采用一步一步的详细过程来演示大模型中function calling如何使用。

在实际场景中,我们还需要实现中间过程的函数执行过程。

以下将介绍在OpenAI, LangChain中如何实现function calling。后面我们将使用的3个函数(这些函数仅用于测试,实际场景中可替换为具体的工具或API)如下:

  1. def get_pizza_info(pizza_name: str):
  2.     # get pizza info by pizza name
  3.     pizza_info = {
  4.         "name": pizza_name,
  5.         "price""10.99"
  6.     }
  7.     return json.dumps(pizza_info)
  8. def get_weather_info(city: str):
  9.     # get city weather info with mock result
  10.     weather_info = {"Shanghai""Rainy""Beijing""Snow"}
  11.     return weather_info.get(city, "Sunny")
  12. def get_rectangle_area(width: float, length: float):
  13.     # calculate the rectangle with given width and length
  14.     return f"The area of this rectangle is {width * length}."

openai调用function calling

在OpenAI的官方模块openai中实现function calling的代码如下:

  1. # -*- coding: utf-8 -*-
  2. from openai import OpenAI
  3. import json
  4. client = OpenAI(api_key="sk-xxx")
  5. def get_pizza_info(pizza_name: str):
  6.     pizza_info = {
  7.         "name": pizza_name,
  8.         "price""10.99"
  9.     }
  10.     return json.dumps(pizza_info)
  11. def get_weather_info(city: str):
  12.     weather_info = {"Shanghai""Rainy""Beijing""Snow"}
  13.     return weather_info.get(city, "Sunny")
  14. def get_rectangle_area(width: float, length: float):
  15.     return f"The area of this rectangle is {width * length}."
  16. function_mapping = {"get_pizza_info": get_pizza_info,
  17.                     "get_weather_info": get_weather_info,
  18.                     "get_rectangle_area": get_rectangle_area}
  19. functions = [
  20.     {
  21.         "name""get_pizza_info",
  22.         "description""Get name and price of a pizza of the restaurant",
  23.         "parameters": {
  24.             "type""object",
  25.             "properties": {
  26.                 "pizza_name": {
  27.                     "type""string",
  28.                     "description""The name of the pizza, e.g. Salami",
  29.                 },
  30.             },
  31.             "required": ["pizza_name"],
  32.         }
  33.     },
  34.     {
  35.         "name""get_weather_info",
  36.         "description""Get the weather information of a city",
  37.         "parameters": {
  38.             "type""object",
  39.             "properties": {
  40.                 "city": {
  41.                     "type""string",
  42.                     "description""The name of the city, e.g. Shanghai",
  43.                 },
  44.             },
  45.             "required": ["city"],
  46.         }
  47.     },
  48.     {
  49.         "name""get_rectangle_area",
  50.         "description""Get the area of a rectangle with given width and length",
  51.         "parameters": {
  52.             "type""object",
  53.             "properties": {
  54.                 "width": {
  55.                     "type""number",
  56.                     "description""The width of a rectangle",
  57.                 },
  58.                 "length": {
  59.                     "type""number",
  60.                     "description""The length of a rectangle",
  61.                 }
  62.             },
  63.             "required": ["width""length"],
  64.         }
  65.     }
  66. ]
  67. def chat(query):
  68.     response = client.chat.completions.create(
  69.         model="gpt-3.5-turbo-0613",
  70.         messages=[{"role""user""content": query}],
  71.         functions=functions
  72.     )
  73.     message = response.dict()["choices"][0]["message"]
  74.     print('message: ', message)
  75.     function_call_info = message.get("function_call")
  76.     if not function_call_info:
  77.         return message
  78.     else:
  79.         function_name = function_call_info["name"]
  80.         arg_name = json.loads(function_call_info["arguments"])
  81.         print(f"function name and arg name: ", function_name, arg_name)
  82.         if function_name in function_mapping:
  83.             function_response = function_mapping[function_name](**arg_name)
  84.             final_response = client.chat.completions.create(
  85.                 model="gpt-3.5-turbo-0613",
  86.                 messages=[
  87.                     {"role""user""content": query},
  88.                     {"role""assistant""content"None"function_call": function_call_info},
  89.                     {
  90.                         "role""function",
  91.                         "name": function_name,
  92.                         "content": function_response
  93.                     },
  94.                 ],
  95.             )
  96.             return final_response.dict()["choices"][0]["message"]
  97.         else:
  98.             return "wrong function name with function call"
  99. query1 = "What is the capital of france?"
  100. print("answer: ", chat(query1), end="\n\n")
  101. query2 = "How much does pizza Domino cost?"
  102. print("answer: ", chat(query2), end="\n\n")
  103. query3 = "What is the weather like in Beijing?"
  104. print("answer: ", chat(query3), end="\n\n")
  105. query4 = "calculate the rectangle area with width 3 and length 5."
  106. print("answer: ", chat(query4), end="\n\n")

输出结果如下:

  1. query:  What is the capital of france?
  2. message:  {'content''The capital of France is Paris.''role''assistant''function_call'None'tool_calls'None}
  3. answer:  {'content''The capital of France is Paris.''role''assistant''function_call'None'tool_calls'None}
  4. query:  How much does pizza Domino cost?
  5. message:  {'content'None'role''assistant''function_call': {'arguments''{\n  "pizza_name": "Domino"\n}''name''get_pizza_info'}, 'tool_calls'None}
  6. function name and arg name:  get_pizza_info {'pizza_name''Domino'}
  7. answer:  The cost of a Domino pizza is $10.99.
  8. query:  What is the weather like in Beijing?
  9. message:  {'content'None'role''assistant''function_call': {'arguments''{\n  "city": "Beijing"\n}''name''get_weather_info'}, 'tool_calls'None}
  10. function name and arg name:  get_weather_info {'city''Beijing'}
  11. answer:  The weather in Beijing is currently experiencing snow.
  12. query:  calculate the rectangle area with width 3 and length 5.
  13. message:  {'content'None'role''assistant''function_call': {'arguments''{\n  "width": 3,\n  "length": 5\n}''name''get_rectangle_area'}, 'tool_calls'None}
  14. function name and arg name:  get_rectangle_area {'width'3'length'5}
  15. answer:  The area of a rectangle can be calculated by multiplying its width by its length. In this case, the width is 3 and the length is 5. Therefore, the area of the rectangle is 3 * 5 = 15 square units.

LangChain调用function calling

langchain中实现function calling的代码相对简洁写,function calling的结果在Message中的additional_kwargs变量中,实现代码如下:

  1. # -*- coding: utf-8 -*-
  2. import os
  3. import json
  4. from langchain.chat_models import ChatOpenAI
  5. from langchain.schema import HumanMessage, AIMessage, ChatMessage
  6. os.environ["OPENAI_API_KEY"] = "sk-xxx"
  7. def get_pizza_info(pizza_name: str):
  8.     pizza_info = {
  9.         "name": pizza_name,
  10.         "price""10.99"
  11.     }
  12.     return json.dumps(pizza_info)
  13. def get_weather_info(city: str):
  14.     weather_info = {"Shanghai""Rainy""Beijing""Snow"}
  15.     return weather_info.get(city, "Sunny")
  16. def get_rectangle_area(width: float, length: float):
  17.     return f"The area of this rectangle is {width * length}."
  18. function_mapping = {"get_pizza_info": get_pizza_info,
  19.                     "get_weather_info": get_weather_info,
  20.                     "get_rectangle_area": get_rectangle_area}
  21. functions = [
  22.     {
  23.         "name""get_pizza_info",
  24.         "description""Get name and price of a pizza of the restaurant",
  25.         "parameters": {
  26.             "type""object",
  27.             "properties": {
  28.                 "pizza_name": {
  29.                     "type""string",
  30.                     "description""The name of the pizza, e.g. Salami",
  31.                 },
  32.             },
  33.             "required": ["pizza_name"],
  34.         }
  35.     },
  36.     {
  37.         "name""get_weather_info",
  38.         "description""Get the weather information of a city",
  39.         "parameters": {
  40.             "type""object",
  41.             "properties": {
  42.                 "city": {
  43.                     "type""string",
  44.                     "description""The name of the city, e.g. Shanghai",
  45.                 },
  46.             },
  47.             "required": ["city"],
  48.         }
  49.     },
  50.     {
  51.         "name""get_rectangle_area",
  52.         "description""Get the area of a rectangle with given width and length",
  53.         "parameters": {
  54.             "type""object",
  55.             "properties": {
  56.                 "width": {
  57.                     "type""number",
  58.                     "description""The width of a rectangle",
  59.                 },
  60.                 "length": {
  61.                     "type""number",
  62.                     "description""The length of a rectangle",
  63.                 }
  64.             },
  65.             "required": ["width""length"],
  66.         }
  67.     }
  68. ]
  69. def chat(query):
  70.     llm = ChatOpenAI(model="gpt-3.5-turbo-0613")
  71.     message = llm.predict_messages(
  72.         [HumanMessage(content=query)], functions=functions
  73.     )
  74.     print('message: ', message, type(message))
  75.     function_call_info = message.additional_kwargs.get("function_call"None)
  76.     if not function_call_info:
  77.         return message
  78.     else:
  79.         function_name = function_call_info["name"]
  80.         arg_name = json.loads(function_call_info["arguments"])
  81.         print(f"function name and arg name: ", function_name, arg_name)
  82.         if function_name in function_mapping:
  83.             function_response = function_mapping[function_name](**arg_name)
  84.             final_response = llm.predict_messages(
  85.                 [
  86.                     HumanMessage(content=query),
  87.                     AIMessage(content=str(message.additional_kwargs)),
  88.                     ChatMessage(
  89.                         role="function",
  90.                         additional_kwargs={
  91.                             "name": function_name
  92.                         },
  93.                         content=function_response
  94.                     ),
  95.                 ]
  96.             )
  97.             return final_response.content
  98.         else:
  99.             return "wrong function name with function call"
  100. query1 = "What is the capital of Japan?"
  101. print("answer:", chat(query1), end='\n\n')
  102. query2 = "How much does pizza Domino cost?"
  103. print("answer:", chat(query2), end='\n\n')
  104. query3 = "What is the weather like in Paris?"
  105. print("answer: ", chat(query3), end="\n\n")
  106. query4 = "calculate the rectangle area with width 3 and length 10"
  107. print("answer: ", chat(query4), end="\n\n")

OpenAI Assistant API支持function calling

Assistant API是OpenAI在今年OpenAI开发者大会中提出的创新功能。Assistants API允许用户在自己的应用程序中构建AI助手。助手有指令,可以利用模型、工具和知识来响应用户查询。Assistants API目前支持三种类型的工具:代码解释器Code Interpreter)、检索Retrieval)和函数调用Function Calling)。

 

fee5f78fb6d6ce547d0415ed6237598d.png

我们来看看,在openai中的Assistant API如何支持function calling。

  1. import time
  2. import json
  3. from openai import OpenAI
  4. def get_pizza_info(pizza_name: str):
  5.     pizza_info = {
  6.         "name": pizza_name,
  7.         "price""10.99"
  8.     }
  9.     return json.dumps(pizza_info)
  10. def get_weather_info(city: str):
  11.     weather_info = {"Shanghai""Rainy""Beijing""Snow"}
  12.     return weather_info.get(city, "Sunny")
  13. def get_rectangle_area(width: float, length: float):
  14.     return f"The area of this rectangle is {width * length}."
  15. function_mapping = {"get_pizza_info": get_pizza_info,
  16.                     "get_weather_info": get_weather_info,
  17.                     "get_rectangle_area": get_rectangle_area}
  18. functions = [
  19.     {
  20.         "name""get_pizza_info",
  21.         "description""Get name and price of a pizza of the restaurant",
  22.         "parameters": {
  23.             "type""object",
  24.             "properties": {
  25.                 "pizza_name": {
  26.                     "type""string",
  27.                     "description""The name of the pizza, e.g. Salami",
  28.                 },
  29.             },
  30.             "required": ["pizza_name"],
  31.         }
  32.     },
  33.     {
  34.         "name""get_weather_info",
  35.         "description""Get the weather information of a city",
  36.         "parameters": {
  37.             "type""object",
  38.             "properties": {
  39.                 "city": {
  40.                     "type""string",
  41.                     "description""The name of the city, e.g. Shanghai",
  42.                 },
  43.             },
  44.             "required": ["city"],
  45.         }
  46.     },
  47.     {
  48.         "name""get_rectangle_area",
  49.         "description""Get the area of a rectangle with given width and length",
  50.         "parameters": {
  51.             "type""object",
  52.             "properties": {
  53.                 "width": {
  54.                     "type""number",
  55.                     "description""The width of a rectangle",
  56.                 },
  57.                 "length": {
  58.                     "type""number",
  59.                     "description""The length of a rectangle",
  60.                 }
  61.             },
  62.             "required": ["width""length"],
  63.         }
  64.     }
  65. ]
  66. client = OpenAI(api_key="sk-xxx")
  67. assistant = client.beta.assistants.create(
  68.     name="assistant test",
  69.     instructions="You are a helpful assistant, ready to answer user's questions.",
  70.     model="gpt-3.5-turbo-0613",
  71. )
  72. MATH_ASSISTANT_ID = assistant.id
  73. print("assistant id: ", MATH_ASSISTANT_ID)
  74. assistant = client.beta.assistants.update(
  75.     MATH_ASSISTANT_ID,
  76.     tools=[
  77.         {"type""function""function": function} for function in functions
  78.     ],
  79. )
  80. print("assistant id: ", assistant.id)
  81. def submit_message(assistant_id, thread, user_message):
  82.     client.beta.threads.messages.create(
  83.         thread_id=thread.id, role="user", content=user_message
  84.     )
  85.     return client.beta.threads.runs.create(
  86.         thread_id=thread.id,
  87.         assistant_id=assistant_id,
  88.     )
  89. def create_thread_and_run(user_input):
  90.     thread = client.beta.threads.create()
  91.     run = submit_message(MATH_ASSISTANT_ID, thread, user_input)
  92.     return thread, run
  93. def wait_on_run(run, thread):
  94.     while run.status == "queued" or run.status == "in_progress":
  95.         run = client.beta.threads.runs.retrieve(
  96.             thread_id=thread.id,
  97.             run_id=run.id,
  98.         )
  99.         time.sleep(0.5)
  100.     return run
  101. def get_response(thread):
  102.     return client.beta.threads.messages.list(thread_id=thread.id, order="asc")
  103. # Pretty printing helper
  104. def pretty_print(messages):
  105.     print("# Messages")
  106.     for m in messages:
  107.         print(f"{m.role}{m.content[0].text.value}")
  108.     print()
  109. query = "How much does pizza Domino cost?"
  110. thread, run = create_thread_and_run(query)
  111. run = wait_on_run(run, thread)
  112. # Extract single tool call
  113. tool_call = run.required_action.submit_tool_outputs.tool_calls[0]
  114. name = tool_call.function.name
  115. arguments = json.loads(tool_call.function.arguments)
  116. my_response = function_mapping[name](**arguments)
  117. print("function response: ", my_response)
  118. # use function response for rerun
  119. final_run = client.beta.threads.runs.submit_tool_outputs(
  120.     thread_id=thread.id,
  121.     run_id=run.id,
  122.     tool_outputs=[
  123.         {
  124.             "tool_call_id": tool_call.id,
  125.             "output": json.dumps(my_response),
  126.         }
  127.     ],
  128. )
  129. final_run = wait_on_run(final_run, thread)
  130. pretty_print(get_response(thread))

输出结果如下:

  1. assistant id:  asst_ElovRUJRLqBeYk2Gu2CUIiU9
  2. assistant id:  asst_ElovRUJRLqBeYk2Gu2CUIiU9
  3. function response:  {"name""Domino""price""10.99"}
  4. # Messages
  5. user: How much does pizza Domino cost?
  6. assistant: The pizza Domino from the restaurant costs $10.99.

LangChain Assistant API支持function calling

可以看到在openai模块中,在Assistant API中实现function calling,较为麻烦。而新版的langchain(0.0.339)中已经添加对Assistant API的支持,我们来看看在langchain中如何支持function calling。

实现代码如下:

  1. # -*- coding: utf-8 -*-
  2. # @place: Pudong, Shanghai 
  3. # @contact: lianmingjie@shanda.com
  4. # @file: assistant_api_with_functions.py
  5. # @time: 2023/11/23 11:00
  6. import os
  7. import json
  8. from langchain.agents.openai_assistant import OpenAIAssistantRunnable
  9. from langchain.schema.agent import AgentFinish
  10. from langchain.agents import Tool
  11. from langchain.tools import StructuredTool
  12. os.environ["OPENAI_API_KEY"] = "sk-xxx"
  13. def get_pizza_info(pizza_name: str):
  14.     pizza_info = {
  15.         "name": pizza_name,
  16.         "price""10.99"
  17.     }
  18.     return json.dumps(pizza_info)
  19. def get_weather_info(city: str):
  20.     weather_info = {"Shanghai""Rainy""Beijing""Snow"}
  21.     return weather_info.get(city, "Sunny")
  22. def get_rectangle_area(width: float = 1.0, length: float = 1.0):
  23.     return f"The area of this rectangle is {width * length}."
  24. function_mapping = {"get_pizza_info": get_pizza_info,
  25.                     "get_weather_info": get_weather_info,
  26.                     "get_rectangle_area": get_rectangle_area}
  27. functions = [
  28.     {
  29.         "name""get_pizza_info",
  30.         "description""Get name and price of a pizza of the restaurant",
  31.         "parameters": {
  32.             "type""object",
  33.             "properties": {
  34.                 "pizza_name": {
  35.                     "type""string",
  36.                     "description""The name of the pizza, e.g. Salami",
  37.                 },
  38.             },
  39.             "required": ["pizza_name"],
  40.         }
  41.     },
  42.     {
  43.         "name""get_weather_info",
  44.         "description""Get the weather information of a city",
  45.         "parameters": {
  46.             "type""object",
  47.             "properties": {
  48.                 "city": {
  49.                     "type""string",
  50.                     "description""The name of the city, e.g. Shanghai",
  51.                 },
  52.             },
  53.             "required": ["city"],
  54.         }
  55.     },
  56.     {
  57.         "name""get_rectangle_area",
  58.         "description""Get the area of a rectangle with given width and length",
  59.         "parameters": {
  60.             "type""object",
  61.             "properties": {
  62.                 "width": {
  63.                     "type""number",
  64.                     "description""The width of a rectangle",
  65.                 },
  66.                 "length": {
  67.                     "type""number",
  68.                     "description""The length of a rectangle",
  69.                 }
  70.             },
  71.             "required": ["width""length"],
  72.         }
  73.     }
  74. ]
  75. tools = [Tool(name=func["name"],
  76.               func=function_mapping[func["name"]],
  77.               description=func["description"]) for func in functions[:-1]]
  78. tools.append(StructuredTool.from_function(get_rectangle_area, name="get_rectangle_area", description="Get the area of a rectangle with given width and length"))
  79. agent = OpenAIAssistantRunnable.create_assistant(
  80.     name="langchain assistant",
  81.     instructions="You are a helpful assistant, ready to answer user's questions.",
  82.     tools=tools,
  83.     model="gpt-3.5-turbo-0613",
  84.     as_agent=True,
  85. )
  86. def execute_agent(agent, tools, input):
  87.     tool_map = {tool.name: tool for tool in tools}
  88.     response = agent.invoke(input)
  89.     while not isinstance(response, AgentFinish):
  90.         tool_outputs = []
  91.         for action in response:
  92.             print(action.tool, action.tool_input)
  93.             tool_output = tool_map[action.tool].invoke(action.tool_input)
  94.             print(action.tool, action.tool_input, tool_output, end="\n\n")
  95.             tool_outputs.append(
  96.                 {"output": tool_output, "tool_call_id": action.tool_call_id}
  97.             )
  98.         response = agent.invoke(
  99.             {
  100.                 "tool_outputs": tool_outputs,
  101.                 "run_id": action.run_id,
  102.                 "thread_id": action.thread_id,
  103.             }
  104.         )
  105.     return response
  106. query = "How much does pizza Domino cost?"
  107. query = "What is the capital of france?"
  108. query = "What is the weather like in Beijing?"
  109. query = "calculate the rectangle area with width 3 and length 5."
  110. response = execute_agent(agent, tools, {"content": query})
  111. print(response.return_values["output"])

注意,函数get_rectangle_area为多参数输入,因此需使用StructuredTool.

网页Assistant支持function calling

在OpenAI中的官网中,Assistant已经支持function calling.

 

b828a33e22dc8a632491092f2b618353.png

 

 

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/知新_RL/article/detail/200082
推荐阅读
相关标签
  

闽ICP备14008679号