[GH-ISSUE #4398] KeyError: 'name' when using completions with tool use in mistral #2751

Closed
opened 2026-04-12 13:03:41 -05:00 by GiteaMirror · 6 comments
Owner

Originally created by @r4881t on GitHub (May 13, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/4398

What is the issue?

I am running Ollama + Litellm with Autogen.

When I try it, I keep getting the error below

Traceback (most recent call last):
  File "/Users/pranavprakash/workspace/litellm/venv/lib/python3.11/site-packages/litellm/llms/ollama_chat.py", line 422, in ollama_acompletion
    "function": {"name": function_call["name"], "arguments": json.dumps(function_call["arguments"])},
                         ~~~~~~~~~~~~~^^^^^^^^
KeyError: 'name'
Traceback (most recent call last):
  File "/Users/pranavprakash/workspace/litellm/venv/lib/python3.11/site-packages/litellm/main.py", line 324, in acompletion
    response = await init_response
               ^^^^^^^^^^^^^^^^^^^
  File "/Users/pranavprakash/workspace/litellm/venv/lib/python3.11/site-packages/litellm/llms/ollama_chat.py", line 448, in ollama_acompletion
    raise e
  File "/Users/pranavprakash/workspace/litellm/venv/lib/python3.11/site-packages/litellm/llms/ollama_chat.py", line 422, in ollama_acompletion
    "function": {"name": function_call["name"], "arguments": json.dumps(function_call["arguments"])},
                         ~~~~~~~~~~~~~^^^^^^^^
KeyError: 'name'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/pranavprakash/workspace/litellm/venv/lib/python3.11/site-packages/litellm/proxy/proxy_server.py", line 3653, in chat_completion
    responses = await asyncio.gather(
                ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/pranavprakash/workspace/litellm/venv/lib/python3.11/site-packages/litellm/utils.py", line 3708, in wrapper_async
    raise e
  File "/Users/pranavprakash/workspace/litellm/venv/lib/python3.11/site-packages/litellm/utils.py", line 3536, in wrapper_async
    result = await original_function(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/pranavprakash/workspace/litellm/venv/lib/python3.11/site-packages/litellm/main.py", line 345, in acompletion
    raise exception_type(
          ^^^^^^^^^^^^^^^
  File "/Users/pranavprakash/workspace/litellm/venv/lib/python3.11/site-packages/litellm/utils.py", line 9220, in exception_type
    raise e
  File "/Users/pranavprakash/workspace/litellm/venv/lib/python3.11/site-packages/litellm/utils.py", line 9195, in exception_type
    raise APIConnectionError(
litellm.exceptions.APIConnectionError: 'name'
INFO:     127.0.0.1:50731 - "POST /chat/completions HTTP/1.1" 500 Internal Server Error

The post call being made is as below

DEBUG - openai._base_client -  Request options: {'method': 'post', 'url': '/chat/completions', 'files': None, 'json_data': {'messages': [{'content': "Your name is AgentX. You can help with web3 q&a and research. You should decompose the task and then use the appropriate tools to solve it.RULES:1. When searching for categories, if there are multiple possible categories, use all of them2. When searching for trending coins, order by volume in last 24 hours.3. When preparing final response include ALL the relevant data asked in the question4. As much as possible show the absolute numbers and the percentage change along with the date5. You may use the 'previous messages' to understand the context of current QueryReturn 'TERMINATE' when the task is done.", 'role': 'system'}, {'content': "Previous Messages: \nQuery: What are your capabilities?. Answer: As your web3 assistant, I have several capabilities to help with various crypto-related tasks:\n\n1. **Cryptocurrency Market Information**: I can provide real-time and historical data on cryptocurrency prices, market caps, volume, and changes for individual coins or across categories. This includes data on top gainers, top losers, and trending coins.\n\n2. **Categories Exploration**: I can search and provide information on various cryptocurrency categories, including DeFi, NFTs, AI, SocialFi, and more.\n\n3. **NFT Insights**: I can fetch trending NFTs based on different criteria and time frames, and provide details on specific NFTs owned by users.\n\n4. **User and Wallet Services**: I can retrieve user details, check wallet balances for specific user IDs, and perform token transfers between wallets on supported chains.\n\n5. **Transaction History**: I can provide a detailed transaction history for specific users, helping track their activities and balances over time.\n\n6. **Global Market Insights**: I can give an overview of the global cryptocurrency market capitalization and volume trends.\n\nThese tools and services are designed to help you navigate the web3 space, whether you're investing, researching, or managing crypto assets and NFTs. \nQuery: What about AI category?. Answer: Here are the top 3 tokens in the Artificial Intelligence (AI) category based on trading volume over the last month:\n\n1. **Render (RNDR)**\n   - **Current Price**: USD 10.90\n   - **Market Cap**: USD 4,226,950,113\n   - **Price Change over 30 Days**: +28.24%\n\n2. **Fetch.ai (FET)**\n   - **Current Price**: USD 2.21\n   - **Market Cap**: USD 5,560,924,883\n   - **Price Change over 30 Days**: -5.77%\n\n3. **The Graph (GRT)**\n   - **Current Price**: USD 0.283\n   - **Market Cap**: USD 2,683,949,970\n   - **Price Change over 30 Days**: -2.78%\n\nThese tokens are currently the most traded within the AI category for the past month. Please consider these details for your investment decisions. \nQuery: okay, so I want to invest some money in SocialFi category. I have been hearing a lot about it. Can you please tell me about the top 3 tokens alongwith info about them? Limit your research to last one month only.. Answer: The top 3 tokens in the SocialFi category based on the last month's data, ordered by trading volume, are:\n\n1. **Theta Network (THETA)**\n   - **Current Price**: USD 2.01\n   - **Market Cap**: USD 2,004,443,416\n   - **Price Change over 30 Days**: -27.17%\n   - **Volume High (24h)**: USD 2.04\n   - **Volume Low (24h)**: USD 1.98\n\n2. **CyberConnect (CYBER)**\n   - **Current Price**: USD 8.02\n   - **Market Cap**: USD 171,831,014\n   - **Price Change over 30 Days**: -31.18%\n   - **Fully Diluted Market Valuation**: USD 800,072,376\n   - **Volume High (24h)**: USD 8.01\n   - **Volume Low (24h)**: USD 7.67\n\n3. **Steem Dollars (SBD)**\n   - **Current Price**: USD 3.66\n   - **Market Cap**: USD 48,714,447\n   - **Price Change over 30 Days**: -19.95%\n   - **Volume High (24h)**: USD 3.92\n   - **Volume Low (24h)**: USD 3.53\n\nThese tokens are currently the most traded within the SocialFi category for the past month, but note their decline in price during this period. Please consider this data for your investment decisions.. Current: \nUser_id: '2d468bcf-ed13-4767-8c67-ffd0880a7a92'. Query: What is the current price of bitcoin?", 'role': 'user'}], 'model': 'NotRequired', 'stream': False, 'tools': [{'type': 'function', 'function': {'description': 'Available Cryptocurrency Categories', 'name': 'available_cryptocurrency_categories', 'parameters': {'type': 'object', 'properties': {}, 'required': []}}}, {'type': 'function', 'function': {'description': 'Current Price of a single or multiple Cryptocurrency Tokens', 'name': 'current_price_tool', 'parameters': {'type': 'object', 'properties': {'tokens': {'anyOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}], 'description': 'A single token or multiple tokens'}, 'vs_currency': {'type': 'string', 'default': 'usd', 'description': 'Base currency'}}, 'required': ['tokens']}}}, {'type': 'function', 'function': {'description': 'Historical Price of single Cryptocurrency Token', 'name': 'historical_price_tool', 'parameters': {'type': 'object', 'properties': {'token': {'type': 'string', 'default': 'usd', 'description': 'vs_currency'}, 'vs_currency': {'type': 'string', 'default': 'usd', 'description': 'vs_currency'}, 'days': {'type': 'number', 'default': 7, 'description': 'days'}}, 'required': ['token']}}}, {'type': 'function', 'function': {'description': 'Top Gainers of Cryptocurrency Tokens', 'name': 'top_gainers_tool', 'parameters': {'type': 'object', 'properties': {'vs_currency': {'type': 'string', 'default': '24h', 'description': 'duration'}, 'duration': {'type': 'string', 'default': '24h', 'description': 'duration'}, 'top_coins': {'type': 'integer', 'default': 10, 'description': 'result_count'}, 'result_count': {'type': 'integer', 'default': 10, 'description': 'result_count'}}, 'required': []}}}, {'type': 'function', 'function': {'description': 'Top Losers of Cryptocurrency Tokens', 'name': 'top_losers_tool', 'parameters': {'type': 'object', 'properties': {'vs_currency': {'type': 'string', 'default': '24h', 'description': 'duration'}, 'duration': {'type': 'string', 'default': '24h', 'description': 'duration'}, 'top_coins': {'type': 'integer', 'default': 10, 'description': 'result_count'}, 'result_count': {'type': 'integer', 'default': 10, 'description': 'result_count'}}, 'required': []}}}, {'type': 'function', 'function': {'description': 'Search cryptocurrency and get its market cap, liquidity, volume, etc. Not meant for historical data analysis. Use the tokens from this response along with historical_price_tool for historical data analysis.', 'name': 'search_coins', 'parameters': {'type': 'object', 'properties': {'category': {'type': 'string', 'default': None, 'description': 'The category-id in which coins are search for'}, 'market_cap_min': {'type': 'integer', 'default': None, 'description': 'Minimum Market Cap filter'}, 'market_cap_max': {'type': 'integer', 'default': None, 'description': 'Maximum Market Cap filter'}, 'fdv_min': {'type': 'integer', 'default': None, 'description': 'Fully Diluted Value minimum filter'}, 'fdv_max': {'type': 'integer', 'default': None, 'description': 'Fully Diluted Value maximum filter'}, 'circulating_supply_percentage_min': {'type': 'integer', 'default': None, 'description': 'Min Circulating supply as a percentage of total supply filter'}, 'circulating_supply_percentage_max': {'type': 'integer', 'default': None, 'description': 'Max circulating supply as a percentage of total supply filter'}, 'total_volume': {'type': 'integer', 'default': None, 'description': 'Total Volume Traded'}, 'order': {'enum': ['market_cap_asc', 'market_cap_desc', 'volume_asc', 'volume_desc'], 'type': 'string', 'default': 'market_cap_desc', 'description': 'Ordering of results'}, 'count': {'type': 'integer', 'default': 10, 'description': 'count'}, 'price_change_percentage': {'enum': ['1h', '24h', '7d', '14d', '30d', '200d', '1y'], 'type': 'string', 'default': '24h', 'description': 'price change percentage Duration'}, 'sparkline': {'type': 'boolean', 'default': False, 'description': 'Show Spark Line'}, 'vs_currency': {'type': 'string', 'default': 'usd', 'description': 'The base currency'}}, 'required': []}}}, {'type': 'function', 'function': {'description': 'Trending Cryptocurrency Tokens Across all categories', 'name': 'trending_coins', 'parameters': {'type': 'object', 'properties': {}, 'required': []}}}, {'type': 'function', 'function': {'description': 'Global Market Cap and Volume', 'name': 'global_market_cap_and_volume', 'parameters': {'type': 'object', 'properties': {'days': {'type': 'integer', 'default': 7, 'description': 'Get data for these many days'}, 'vs_currency': {'type': 'string', 'default': 'usd', 'description': 'The base currency'}}, 'required': []}}}, {'type': 'function', 'function': {'description': 'Trending NFTs', 'name': 'trending_nfts', 'parameters': {'type': 'object', 'properties': {'time_frame': {'enum': ['one_hour', 'two_hours', 'eight_hours', 'one_day', 'two_days', 'seven_days'], 'type': 'string', 'description': 'Trending Mint Time Frame'}, 'criteria': {'enum': ['unique_wallets', 'total_mints'], 'type': 'string', 'description': 'Trending Mint Criteria'}, 'limit': {'type': 'integer', 'default': 10, 'description': 'limit'}}, 'required': ['time_frame', 'criteria']}}}, {'type': 'function', 'function': {'description': 'Get NFTs for user_id', 'name': 'get_nfts', 'parameters': {'type': 'object', 'properties': {'user_id': {'type': 'string', 'description': 'The user_id of the user '}}, 'required': ['user_id']}}}, {'type': 'function', 'function': {'description': 'Get Transaction History for user_id', 'name': 'get_transaction_history', 'parameters': {'type': 'object', 'properties': {'user_id': {'type': 'string', 'description': 'The user_id of the user '}}, 'required': ['user_id']}}}, {'type': 'function', 'function': {'description': "Transfer Tokens from one wallet to another.Before calling this function, make sure to (a) call get_wallet_balance to check the balance AND to get the currency address AND (b) call the supported_chains to get the 'slug', which will be used as a parameter in this function.", 'name': 'transfer_tokens', 'parameters': {'type': 'object', 'properties': {'uniqueUserId': {'type': 'string', 'description': 'The user_id of the user '}, 'to': {'type': 'string', 'description': 'The user_id of the recipient '}, 'amount': {'type': 'string', 'description': 'The amount of tokens to transfer '}, 'currencyAddress': {'type': 'string', 'description': 'The address of the currency '}, 'chain': {'type': 'string', 'default': 'ethereum', 'description': "The 'slug' of blockchain to transfer on "}}, 'required': ['uniqueUserId', 'to', 'amount', 'currencyAddress']}}}, {'type': 'function', 'function': {'description': 'Supported Chains for EVM Wallet', 'name': 'supported_chains', 'parameters': {'type': 'object', 'properties': {}, 'required': []}}}, {'type': 'function', 'function': {'description': 'Get User Details For user_id including wallet address, points and more.', 'name': 'get_user_details', 'parameters': {'type': 'object', 'properties': {'user_id': {'type': 'string', 'description': 'User Id for whom details to be fetched'}}, 'required': ['user_id']}}}, {'type': 'function', 'function': {'description': 'Get Wallet Balance for user_id', 'name': 'get_wallet_balance', 'parameters': {'type': 'object', 'properties': {'user_id': {'type': 'string', 'description': 'The user_id of the user '}}, 'required': ['user_id']}}}]}}

My Llama mistral is

% ollama list
NAME          	ID          	SIZE  	MODIFIED
llama3:latest 	a6990ed6be41	4.7 GB	6 days ago
mistral:latest	61e88e884507	4.1 GB	About an hour ago

OS

macOS

GPU

Apple

CPU

Apple

Ollama version

0.1.34

Originally created by @r4881t on GitHub (May 13, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/4398 ### What is the issue? I am running Ollama + Litellm with Autogen. When I try it, I keep getting the error below ``` Traceback (most recent call last): File "/Users/pranavprakash/workspace/litellm/venv/lib/python3.11/site-packages/litellm/llms/ollama_chat.py", line 422, in ollama_acompletion "function": {"name": function_call["name"], "arguments": json.dumps(function_call["arguments"])}, ~~~~~~~~~~~~~^^^^^^^^ KeyError: 'name' Traceback (most recent call last): File "/Users/pranavprakash/workspace/litellm/venv/lib/python3.11/site-packages/litellm/main.py", line 324, in acompletion response = await init_response ^^^^^^^^^^^^^^^^^^^ File "/Users/pranavprakash/workspace/litellm/venv/lib/python3.11/site-packages/litellm/llms/ollama_chat.py", line 448, in ollama_acompletion raise e File "/Users/pranavprakash/workspace/litellm/venv/lib/python3.11/site-packages/litellm/llms/ollama_chat.py", line 422, in ollama_acompletion "function": {"name": function_call["name"], "arguments": json.dumps(function_call["arguments"])}, ~~~~~~~~~~~~~^^^^^^^^ KeyError: 'name' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/pranavprakash/workspace/litellm/venv/lib/python3.11/site-packages/litellm/proxy/proxy_server.py", line 3653, in chat_completion responses = await asyncio.gather( ^^^^^^^^^^^^^^^^^^^^^ File "/Users/pranavprakash/workspace/litellm/venv/lib/python3.11/site-packages/litellm/utils.py", line 3708, in wrapper_async raise e File "/Users/pranavprakash/workspace/litellm/venv/lib/python3.11/site-packages/litellm/utils.py", line 3536, in wrapper_async result = await original_function(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/pranavprakash/workspace/litellm/venv/lib/python3.11/site-packages/litellm/main.py", line 345, in acompletion raise exception_type( ^^^^^^^^^^^^^^^ File "/Users/pranavprakash/workspace/litellm/venv/lib/python3.11/site-packages/litellm/utils.py", line 9220, in exception_type raise e File "/Users/pranavprakash/workspace/litellm/venv/lib/python3.11/site-packages/litellm/utils.py", line 9195, in exception_type raise APIConnectionError( litellm.exceptions.APIConnectionError: 'name' INFO: 127.0.0.1:50731 - "POST /chat/completions HTTP/1.1" 500 Internal Server Error ``` The post call being made is as below ``` DEBUG - openai._base_client - Request options: {'method': 'post', 'url': '/chat/completions', 'files': None, 'json_data': {'messages': [{'content': "Your name is AgentX. You can help with web3 q&a and research. You should decompose the task and then use the appropriate tools to solve it.RULES:1. When searching for categories, if there are multiple possible categories, use all of them2. When searching for trending coins, order by volume in last 24 hours.3. When preparing final response include ALL the relevant data asked in the question4. As much as possible show the absolute numbers and the percentage change along with the date5. You may use the 'previous messages' to understand the context of current QueryReturn 'TERMINATE' when the task is done.", 'role': 'system'}, {'content': "Previous Messages: \nQuery: What are your capabilities?. Answer: As your web3 assistant, I have several capabilities to help with various crypto-related tasks:\n\n1. **Cryptocurrency Market Information**: I can provide real-time and historical data on cryptocurrency prices, market caps, volume, and changes for individual coins or across categories. This includes data on top gainers, top losers, and trending coins.\n\n2. **Categories Exploration**: I can search and provide information on various cryptocurrency categories, including DeFi, NFTs, AI, SocialFi, and more.\n\n3. **NFT Insights**: I can fetch trending NFTs based on different criteria and time frames, and provide details on specific NFTs owned by users.\n\n4. **User and Wallet Services**: I can retrieve user details, check wallet balances for specific user IDs, and perform token transfers between wallets on supported chains.\n\n5. **Transaction History**: I can provide a detailed transaction history for specific users, helping track their activities and balances over time.\n\n6. **Global Market Insights**: I can give an overview of the global cryptocurrency market capitalization and volume trends.\n\nThese tools and services are designed to help you navigate the web3 space, whether you're investing, researching, or managing crypto assets and NFTs. \nQuery: What about AI category?. Answer: Here are the top 3 tokens in the Artificial Intelligence (AI) category based on trading volume over the last month:\n\n1. **Render (RNDR)**\n - **Current Price**: USD 10.90\n - **Market Cap**: USD 4,226,950,113\n - **Price Change over 30 Days**: +28.24%\n\n2. **Fetch.ai (FET)**\n - **Current Price**: USD 2.21\n - **Market Cap**: USD 5,560,924,883\n - **Price Change over 30 Days**: -5.77%\n\n3. **The Graph (GRT)**\n - **Current Price**: USD 0.283\n - **Market Cap**: USD 2,683,949,970\n - **Price Change over 30 Days**: -2.78%\n\nThese tokens are currently the most traded within the AI category for the past month. Please consider these details for your investment decisions. \nQuery: okay, so I want to invest some money in SocialFi category. I have been hearing a lot about it. Can you please tell me about the top 3 tokens alongwith info about them? Limit your research to last one month only.. Answer: The top 3 tokens in the SocialFi category based on the last month's data, ordered by trading volume, are:\n\n1. **Theta Network (THETA)**\n - **Current Price**: USD 2.01\n - **Market Cap**: USD 2,004,443,416\n - **Price Change over 30 Days**: -27.17%\n - **Volume High (24h)**: USD 2.04\n - **Volume Low (24h)**: USD 1.98\n\n2. **CyberConnect (CYBER)**\n - **Current Price**: USD 8.02\n - **Market Cap**: USD 171,831,014\n - **Price Change over 30 Days**: -31.18%\n - **Fully Diluted Market Valuation**: USD 800,072,376\n - **Volume High (24h)**: USD 8.01\n - **Volume Low (24h)**: USD 7.67\n\n3. **Steem Dollars (SBD)**\n - **Current Price**: USD 3.66\n - **Market Cap**: USD 48,714,447\n - **Price Change over 30 Days**: -19.95%\n - **Volume High (24h)**: USD 3.92\n - **Volume Low (24h)**: USD 3.53\n\nThese tokens are currently the most traded within the SocialFi category for the past month, but note their decline in price during this period. Please consider this data for your investment decisions.. Current: \nUser_id: '2d468bcf-ed13-4767-8c67-ffd0880a7a92'. Query: What is the current price of bitcoin?", 'role': 'user'}], 'model': 'NotRequired', 'stream': False, 'tools': [{'type': 'function', 'function': {'description': 'Available Cryptocurrency Categories', 'name': 'available_cryptocurrency_categories', 'parameters': {'type': 'object', 'properties': {}, 'required': []}}}, {'type': 'function', 'function': {'description': 'Current Price of a single or multiple Cryptocurrency Tokens', 'name': 'current_price_tool', 'parameters': {'type': 'object', 'properties': {'tokens': {'anyOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}], 'description': 'A single token or multiple tokens'}, 'vs_currency': {'type': 'string', 'default': 'usd', 'description': 'Base currency'}}, 'required': ['tokens']}}}, {'type': 'function', 'function': {'description': 'Historical Price of single Cryptocurrency Token', 'name': 'historical_price_tool', 'parameters': {'type': 'object', 'properties': {'token': {'type': 'string', 'default': 'usd', 'description': 'vs_currency'}, 'vs_currency': {'type': 'string', 'default': 'usd', 'description': 'vs_currency'}, 'days': {'type': 'number', 'default': 7, 'description': 'days'}}, 'required': ['token']}}}, {'type': 'function', 'function': {'description': 'Top Gainers of Cryptocurrency Tokens', 'name': 'top_gainers_tool', 'parameters': {'type': 'object', 'properties': {'vs_currency': {'type': 'string', 'default': '24h', 'description': 'duration'}, 'duration': {'type': 'string', 'default': '24h', 'description': 'duration'}, 'top_coins': {'type': 'integer', 'default': 10, 'description': 'result_count'}, 'result_count': {'type': 'integer', 'default': 10, 'description': 'result_count'}}, 'required': []}}}, {'type': 'function', 'function': {'description': 'Top Losers of Cryptocurrency Tokens', 'name': 'top_losers_tool', 'parameters': {'type': 'object', 'properties': {'vs_currency': {'type': 'string', 'default': '24h', 'description': 'duration'}, 'duration': {'type': 'string', 'default': '24h', 'description': 'duration'}, 'top_coins': {'type': 'integer', 'default': 10, 'description': 'result_count'}, 'result_count': {'type': 'integer', 'default': 10, 'description': 'result_count'}}, 'required': []}}}, {'type': 'function', 'function': {'description': 'Search cryptocurrency and get its market cap, liquidity, volume, etc. Not meant for historical data analysis. Use the tokens from this response along with historical_price_tool for historical data analysis.', 'name': 'search_coins', 'parameters': {'type': 'object', 'properties': {'category': {'type': 'string', 'default': None, 'description': 'The category-id in which coins are search for'}, 'market_cap_min': {'type': 'integer', 'default': None, 'description': 'Minimum Market Cap filter'}, 'market_cap_max': {'type': 'integer', 'default': None, 'description': 'Maximum Market Cap filter'}, 'fdv_min': {'type': 'integer', 'default': None, 'description': 'Fully Diluted Value minimum filter'}, 'fdv_max': {'type': 'integer', 'default': None, 'description': 'Fully Diluted Value maximum filter'}, 'circulating_supply_percentage_min': {'type': 'integer', 'default': None, 'description': 'Min Circulating supply as a percentage of total supply filter'}, 'circulating_supply_percentage_max': {'type': 'integer', 'default': None, 'description': 'Max circulating supply as a percentage of total supply filter'}, 'total_volume': {'type': 'integer', 'default': None, 'description': 'Total Volume Traded'}, 'order': {'enum': ['market_cap_asc', 'market_cap_desc', 'volume_asc', 'volume_desc'], 'type': 'string', 'default': 'market_cap_desc', 'description': 'Ordering of results'}, 'count': {'type': 'integer', 'default': 10, 'description': 'count'}, 'price_change_percentage': {'enum': ['1h', '24h', '7d', '14d', '30d', '200d', '1y'], 'type': 'string', 'default': '24h', 'description': 'price change percentage Duration'}, 'sparkline': {'type': 'boolean', 'default': False, 'description': 'Show Spark Line'}, 'vs_currency': {'type': 'string', 'default': 'usd', 'description': 'The base currency'}}, 'required': []}}}, {'type': 'function', 'function': {'description': 'Trending Cryptocurrency Tokens Across all categories', 'name': 'trending_coins', 'parameters': {'type': 'object', 'properties': {}, 'required': []}}}, {'type': 'function', 'function': {'description': 'Global Market Cap and Volume', 'name': 'global_market_cap_and_volume', 'parameters': {'type': 'object', 'properties': {'days': {'type': 'integer', 'default': 7, 'description': 'Get data for these many days'}, 'vs_currency': {'type': 'string', 'default': 'usd', 'description': 'The base currency'}}, 'required': []}}}, {'type': 'function', 'function': {'description': 'Trending NFTs', 'name': 'trending_nfts', 'parameters': {'type': 'object', 'properties': {'time_frame': {'enum': ['one_hour', 'two_hours', 'eight_hours', 'one_day', 'two_days', 'seven_days'], 'type': 'string', 'description': 'Trending Mint Time Frame'}, 'criteria': {'enum': ['unique_wallets', 'total_mints'], 'type': 'string', 'description': 'Trending Mint Criteria'}, 'limit': {'type': 'integer', 'default': 10, 'description': 'limit'}}, 'required': ['time_frame', 'criteria']}}}, {'type': 'function', 'function': {'description': 'Get NFTs for user_id', 'name': 'get_nfts', 'parameters': {'type': 'object', 'properties': {'user_id': {'type': 'string', 'description': 'The user_id of the user '}}, 'required': ['user_id']}}}, {'type': 'function', 'function': {'description': 'Get Transaction History for user_id', 'name': 'get_transaction_history', 'parameters': {'type': 'object', 'properties': {'user_id': {'type': 'string', 'description': 'The user_id of the user '}}, 'required': ['user_id']}}}, {'type': 'function', 'function': {'description': "Transfer Tokens from one wallet to another.Before calling this function, make sure to (a) call get_wallet_balance to check the balance AND to get the currency address AND (b) call the supported_chains to get the 'slug', which will be used as a parameter in this function.", 'name': 'transfer_tokens', 'parameters': {'type': 'object', 'properties': {'uniqueUserId': {'type': 'string', 'description': 'The user_id of the user '}, 'to': {'type': 'string', 'description': 'The user_id of the recipient '}, 'amount': {'type': 'string', 'description': 'The amount of tokens to transfer '}, 'currencyAddress': {'type': 'string', 'description': 'The address of the currency '}, 'chain': {'type': 'string', 'default': 'ethereum', 'description': "The 'slug' of blockchain to transfer on "}}, 'required': ['uniqueUserId', 'to', 'amount', 'currencyAddress']}}}, {'type': 'function', 'function': {'description': 'Supported Chains for EVM Wallet', 'name': 'supported_chains', 'parameters': {'type': 'object', 'properties': {}, 'required': []}}}, {'type': 'function', 'function': {'description': 'Get User Details For user_id including wallet address, points and more.', 'name': 'get_user_details', 'parameters': {'type': 'object', 'properties': {'user_id': {'type': 'string', 'description': 'User Id for whom details to be fetched'}}, 'required': ['user_id']}}}, {'type': 'function', 'function': {'description': 'Get Wallet Balance for user_id', 'name': 'get_wallet_balance', 'parameters': {'type': 'object', 'properties': {'user_id': {'type': 'string', 'description': 'The user_id of the user '}}, 'required': ['user_id']}}}]}} ``` My Llama mistral is ``` % ollama list NAME ID SIZE MODIFIED llama3:latest a6990ed6be41 4.7 GB 6 days ago mistral:latest 61e88e884507 4.1 GB About an hour ago ``` ### OS macOS ### GPU Apple ### CPU Apple ### Ollama version 0.1.34
GiteaMirror added the bug label 2026-04-12 13:03:41 -05:00
Author
Owner

@mxyng commented on GitHub (May 15, 2024):

Traceback (most recent call last):
  File "/Users/pranavprakash/workspace/litellm/venv/lib/python3.11/site-packages/litellm/llms/ollama_chat.py", line 422, in ollama_acompletion
    "function": {"name": function_call["name"], "arguments": json.dumps(function_call["arguments"])},
                         ~~~~~~~~~~~~~^^^^^^^^
KeyError: 'name'

That exception seems to be raised from LiteLLM. I'd suggest opening an issue there

<!-- gh-comment-id:2112841726 --> @mxyng commented on GitHub (May 15, 2024): ``` Traceback (most recent call last): File "/Users/pranavprakash/workspace/litellm/venv/lib/python3.11/site-packages/litellm/llms/ollama_chat.py", line 422, in ollama_acompletion "function": {"name": function_call["name"], "arguments": json.dumps(function_call["arguments"])}, ~~~~~~~~~~~~~^^^^^^^^ KeyError: 'name' ``` That [exception](https://github.com/BerriAI/litellm/blob/main/litellm/llms/ollama_chat.py#L479) seems to be raised from LiteLLM. I'd suggest opening an issue [there](https://github.com/BerriAI/litellm)
Author
Owner

@marklysze commented on GitHub (May 21, 2024):

@r4881t, did you get any resolution to this issue or find out what's happening? I'm contributing to the AutoGen codebase and I'm having the same issue now as well.

<!-- gh-comment-id:2121715977 --> @marklysze commented on GitHub (May 21, 2024): @r4881t, did you get any resolution to this issue or find out what's happening? I'm contributing to the AutoGen codebase and I'm having the same issue now as well.
Author
Owner

@liuweikarlie commented on GitHub (Jul 2, 2024):

@marklysze Hi! did you solve the problem ? I also get this problem

<!-- gh-comment-id:2202302274 --> @liuweikarlie commented on GitHub (Jul 2, 2024): @marklysze Hi! did you solve the problem ? I also get this problem
Author
Owner

@marklysze commented on GitHub (Jul 2, 2024):

Hey @liuweikarlie, I didn't get a resolution for it - for AutoGen I am working on creating an Ollama Client class that handles function calling and removes the name field on messages.

If you are using AutoGen, check out my PR and try that client class instead of using LiteLLM+Ollama through the native OpenAI API.

If you are not using AutoGen, are you looking for function calling?

CC @r4881t

<!-- gh-comment-id:2202468736 --> @marklysze commented on GitHub (Jul 2, 2024): Hey @liuweikarlie, I didn't get a resolution for it - for AutoGen I am working on creating an Ollama Client class that handles function calling and removes the name field on messages. If you are using AutoGen, check out [my PR](https://github.com/microsoft/autogen/pull/3056) and try that client class instead of using LiteLLM+Ollama through the native OpenAI API. If you are not using AutoGen, are you looking for function calling? CC @r4881t
Author
Owner

@r4881t commented on GitHub (Jul 8, 2024):

I don't have a resolution yet. However great work @marklysze . I will try this and update you if I face any issues.

<!-- gh-comment-id:2214052272 --> @r4881t commented on GitHub (Jul 8, 2024): I don't have a resolution yet. However great work @marklysze . I will try this and update you if I face any issues.
Author
Owner

@prithvikavuri commented on GitHub (Sep 28, 2024):

did it work @r4881t ??

<!-- gh-comment-id:2380385458 --> @prithvikavuri commented on GitHub (Sep 28, 2024): did it work @r4881t ??
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#2751