【作业贴】2025-3-14 AGI2406期 function call多机多卡(下)1. 【基础】申请国内其他大模型apikey,对照官方API文档使用functioncall,并测试课程中的例子 #85

Open
opened 2025-03-18 10:19:47 +08:00 by 11583226719cs · 0 comments

申请通义千问apkey 并运行 python /code/autogen_calculations_function_call.py

config_list=[
# {
# "model": "Llama-3-8B-Instruct-function-calling",
# "base_url": "http://localhost:8000/v1",
# "api_type": "openai",
# "api_key": "NULL", # just a placeholder
# },
# {
# "model": "Llama-3-8B-Instruct",
# "base_url": "http://localhost:8000/v1",
# "api_type": "openai",
# "api_key": "NULL", # just a placeholder
# },
{
"model": "qwen-plus",
"base_url": "https://dashscope.aliyuncs.com/compatible-mode/v1/",
"api_type": "openai",
"api_key": "sk-xxxx",
},

root@z76aec17a61b4db8a00d79277f667e55-task0-0:/code# python /code/autogen_calculations_function_call.py
User (to Assistant):

What is (44232 + 13312 / (232 - 32)) * 5?


USING AUTO REPLY...
[autogen.oai.client: 03-18 10:14:54] {329} WARNING - Model qwen-plus is not found. The cost will be 0. In your config_list, add field {"price" : [prompt_price_per_1k, completion_token_price_per_1k]} for customized pricing.
Assistant (to User):

***** Suggested tool call (call_f3a19c9d9c7a419eba357c): calculator *****
Arguments:
{"a": 232,"b": 32,"operator": "-"}



EXECUTING FUNCTION calculator...
User (to Assistant):

User (to Assistant):

***** Response from calling tool (call_f3a19c9d9c7a419eba357c) *****
200



USING AUTO REPLY...
[autogen.oai.client: 03-18 10:14:56] {329} WARNING - Model qwen-plus is not found. The cost will be 0. In your config_list, add field {"price" : [prompt_price_per_1k, completion_token_price_per_1k]} for customized pricing.
Assistant (to User):

***** Suggested tool call (call_2e8e36967e204706985bff): calculator *****
Arguments:
{"a": 13312,"b": 200,"operator": "/"}



EXECUTING FUNCTION calculator...
User (to Assistant):

User (to Assistant):

***** Response from calling tool (call_2e8e36967e204706985bff) *****
66



USING AUTO REPLY...
[autogen.oai.client: 03-18 10:14:58] {329} WARNING - Model qwen-plus is not found. The cost will be 0. In your config_list, add field {"price" : [prompt_price_per_1k, completion_token_price_per_1k]} for customized pricing.
Assistant (to User):

***** Suggested tool call (call_2371f508319549f3a03baa): calculator *****
Arguments:
{"a": 44232,"b": 66,"operator": "+"}



EXECUTING FUNCTION calculator...
User (to Assistant):

User (to Assistant):

***** Response from calling tool (call_2371f508319549f3a03baa) *****
44298



USING AUTO REPLY...
[autogen.oai.client: 03-18 10:15:00] {329} WARNING - Model qwen-plus is not found. The cost will be 0. In your config_list, add field {"price" : [prompt_price_per_1k, completion_token_price_per_1k]} for customized pricing.
Assistant (to User):

***** Suggested tool call (call_287181d2fcc940139b8361): calculator *****
Arguments:
{"a": 44298,"b": 5,"operator": "*"}



EXECUTING FUNCTION calculator...
User (to Assistant):

User (to Assistant):

***** Response from calling tool (call_287181d2fcc940139b8361) *****
221490



USING AUTO REPLY...
[autogen.oai.client: 03-18 10:15:11] {329} WARNING - Model qwen-plus is not found. The cost will be 0. In your config_list, add field {"price" : [prompt_price_per_1k, completion_token_price_per_1k]} for customized pricing.
Assistant (to User):

The result of the calculation (44232 + 13312 / (232 - 32)) * 5 is 221,490.


User (to Assistant):


USING AUTO REPLY...
[autogen.oai.client: 03-18 10:15:12] {329} WARNING - Model qwen-plus is not found. The cost will be 0. In your config_list, add field {"price" : [prompt_price_per_1k, completion_token_price_per_1k]} for customized pricing.
Assistant (to User):

TERMINATE


root@z76aec17a61b4db8a00d79277f667e55-task0-0:/code#

申请通义千问apkey 并运行 python /code/autogen_calculations_function_call.py config_list=[ # { # "model": "Llama-3-8B-Instruct-function-calling", # "base_url": "http://localhost:8000/v1", # "api_type": "openai", # "api_key": "NULL", # just a placeholder # }, # { # "model": "Llama-3-8B-Instruct", # "base_url": "http://localhost:8000/v1", # "api_type": "openai", # "api_key": "NULL", # just a placeholder # }, { "model": "qwen-plus", "base_url": "https://dashscope.aliyuncs.com/compatible-mode/v1/", "api_type": "openai", "api_key": "sk-xxxx", }, root@z76aec17a61b4db8a00d79277f667e55-task0-0:/code# python /code/autogen_calculations_function_call.py User (to Assistant): What is (44232 + 13312 / (232 - 32)) * 5? -------------------------------------------------------------------------------- >>>>>>>> USING AUTO REPLY... [autogen.oai.client: 03-18 10:14:54] {329} WARNING - Model qwen-plus is not found. The cost will be 0. In your config_list, add field {"price" : [prompt_price_per_1k, completion_token_price_per_1k]} for customized pricing. Assistant (to User): ***** Suggested tool call (call_f3a19c9d9c7a419eba357c): calculator ***** Arguments: {"a": 232,"b": 32,"operator": "-"} ************************************************************************* -------------------------------------------------------------------------------- >>>>>>>> EXECUTING FUNCTION calculator... User (to Assistant): User (to Assistant): ***** Response from calling tool (call_f3a19c9d9c7a419eba357c) ***** 200 ******************************************************************** -------------------------------------------------------------------------------- >>>>>>>> USING AUTO REPLY... [autogen.oai.client: 03-18 10:14:56] {329} WARNING - Model qwen-plus is not found. The cost will be 0. In your config_list, add field {"price" : [prompt_price_per_1k, completion_token_price_per_1k]} for customized pricing. Assistant (to User): ***** Suggested tool call (call_2e8e36967e204706985bff): calculator ***** Arguments: {"a": 13312,"b": 200,"operator": "/"} ************************************************************************* -------------------------------------------------------------------------------- >>>>>>>> EXECUTING FUNCTION calculator... User (to Assistant): User (to Assistant): ***** Response from calling tool (call_2e8e36967e204706985bff) ***** 66 ******************************************************************** -------------------------------------------------------------------------------- >>>>>>>> USING AUTO REPLY... [autogen.oai.client: 03-18 10:14:58] {329} WARNING - Model qwen-plus is not found. The cost will be 0. In your config_list, add field {"price" : [prompt_price_per_1k, completion_token_price_per_1k]} for customized pricing. Assistant (to User): ***** Suggested tool call (call_2371f508319549f3a03baa): calculator ***** Arguments: {"a": 44232,"b": 66,"operator": "+"} ************************************************************************* -------------------------------------------------------------------------------- >>>>>>>> EXECUTING FUNCTION calculator... User (to Assistant): User (to Assistant): ***** Response from calling tool (call_2371f508319549f3a03baa) ***** 44298 ******************************************************************** -------------------------------------------------------------------------------- >>>>>>>> USING AUTO REPLY... [autogen.oai.client: 03-18 10:15:00] {329} WARNING - Model qwen-plus is not found. The cost will be 0. In your config_list, add field {"price" : [prompt_price_per_1k, completion_token_price_per_1k]} for customized pricing. Assistant (to User): ***** Suggested tool call (call_287181d2fcc940139b8361): calculator ***** Arguments: {"a": 44298,"b": 5,"operator": "*"} ************************************************************************* -------------------------------------------------------------------------------- >>>>>>>> EXECUTING FUNCTION calculator... User (to Assistant): User (to Assistant): ***** Response from calling tool (call_287181d2fcc940139b8361) ***** 221490 ******************************************************************** -------------------------------------------------------------------------------- >>>>>>>> USING AUTO REPLY... [autogen.oai.client: 03-18 10:15:11] {329} WARNING - Model qwen-plus is not found. The cost will be 0. In your config_list, add field {"price" : [prompt_price_per_1k, completion_token_price_per_1k]} for customized pricing. Assistant (to User): The result of the calculation (44232 + 13312 / (232 - 32)) * 5 is 221,490. -------------------------------------------------------------------------------- User (to Assistant): -------------------------------------------------------------------------------- >>>>>>>> USING AUTO REPLY... [autogen.oai.client: 03-18 10:15:12] {329} WARNING - Model qwen-plus is not found. The cost will be 0. In your config_list, add field {"price" : [prompt_price_per_1k, completion_token_price_per_1k]} for customized pricing. Assistant (to User): TERMINATE -------------------------------------------------------------------------------- root@z76aec17a61b4db8a00d79277f667e55-task0-0:/code#
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: HswOAuth/llm_share#85
No description provided.