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

Function call didn't work. Because of Deserialization issue #164

Open
ebattulga opened this issue Jan 19, 2024 · 1 comment
Open

Function call didn't work. Because of Deserialization issue #164

ebattulga opened this issue Jan 19, 2024 · 1 comment

Comments

@ebattulga
Copy link

I'm using Function. But deserializer choose wrong class ChatGPTChatCompletionMessage instead of ChatGPTAssistantCompletionMessage.

Function call return Assistant Completion response. But deserializer always return ChatCompletion class and missing some properties. This is actual returning json

{
  "id": "chatcmpl-8icO5Kj0IEqgDr6dU9J0E9Gecv4nQ",
  "object": "chat.completion",
  "created": 1705644685,
  "model": "gpt-3.5-turbo-0613",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": null,
        "tool_calls": [
          {
            "id": "call_Ww3ocoHqydw5xhnS5H1CZImu",
            "type": "function",
            "function": {
              "name": "getExchangeRate",
              "arguments": "{\n  \"currency\": \"USD\"\n}"
            }
          }
        ]
      },
      "logprobs": null,
      "finish_reason": "tool_calls"
    }
  ],
  "usage": {
    "prompt_tokens": 99,
    "completion_tokens": 16,
    "total_tokens": 115
  },
  "system_fingerprint": null
}

But after deserialized object looks like this

{
    "Id": "chatcmpl-8iKN8vlb6QEYiGukfWLAlJNG0jS2V",
    "Object": "chat.completion",
    "Created": "2024-01-18T10:57:14Z",
    "Model": "gpt-3.5-turbo-0613",
    "Choices": [
        {
            "Index": 0,
            "Message": {
                "Role": "assistant",
                "Content": null,
                "Name": null
            },
            "FinishReason": "tool_calls"
        }
    ],
    "SystemFingerprint": null,
    "Usage": {
        "PromptTokens": 97,
        "CompletionTokens": 16,
        "TotalTokens": 113
    }
}

How to fix this to deserialized by ChatGPTAssistantCompletionMessage class.

@johniwasz
Copy link
Owner

Please upgrade to version 1.8.0. This was an oversight in the definition of the response message.

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