Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unknown Finish Reason #127

Closed
alexandergagliano opened this issue Feb 9, 2024 · 2 comments
Closed

Unknown Finish Reason #127

alexandergagliano opened this issue Feb 9, 2024 · 2 comments

Comments

@alexandergagliano
Copy link

  • ChatLab version: 1.3.0
  • Python version: 3.10.12
  • Operating System: CentOS

Description

Hi all! I'm trying to run the tutorial from functionary here after launching a vLLM server. The code returns:

INFO:     127.0.0.1:48176 - "POST /v1/chat/completions HTTP/1.1" 200 OK
UNKNOWN FINISH REASON: 'tool_calls'. If you see this message, report it as an issue to https://github.com/rgbkrk/chatlab/issues
USER: What is the price of the car named 'Rhino'?

Any thoughts on what could be the problem? Thanks!

What I Did

import chatlab
import asyncio

def get_car_price(car_name: str):
    """this function is used to get the price of the car given the name
    :param car_name: name of the car to get the price
    """
    car_price = {
        "rhino": {"price": "$20000"},
        "elephant": {"price": "$25000"}
    }
    for key in car_price:
        if key in car_name.lower():
            return {"price": car_price[key]}
    return {"price": "unknown"}

chat = chatlab.Chat(model="meetkai/functionary-small-v2.2", base_url="http://localhost:8000/v1", api_key="functionary")
chat.register(get_car_price)
asyncio.run(chat.submit("What is the price of the car named 'Rhino'?", stream=False))

for message in chat.messages:
    role = message["role"].upper()
    if "function_call" in message:
        func_name = message["function_call"]["name"]
        func_param = message["function_call"]["arguments"]
        print(f"{role}: call function: {func_name}, arguments:{func_param}")
    else:
        content = message["content"]
        print(f"{role}: {content}")

@rgbkrk
Copy link
Owner

rgbkrk commented Feb 9, 2024

Thanks for reporting. I'm working on this in #125 and will try to get it finished up over the next few weeks.

@rgbkrk
Copy link
Owner

rgbkrk commented Feb 28, 2024

Done in #131. Shipped in v2.0.0.

@rgbkrk rgbkrk closed this as completed Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants