Issue with JSON Parameter Value Becoming '/n' When Using Chinese Language Input

I’m encountering a peculiar issue with a JSON-based interaction system, specifically when processing Chinese language inputs. The system involves sending a JSON request to a function, but the parameter value is not being correctly set when the input is in Chinese.

Description of the Issue:

  • When I send a JSON request with a Chinese language input, the parameter value for a specific function (library_book_search) is incorrectly set as "\n" (a newline character), rather than the expected book title extracted from the user’s input.
  • The function in question is supposed to take a book title as a parameter and search for it in a library database.
  • This issue does not occur when the input is in English.

Example of the Problematic JSON Request:

{
  "model": "gpt-4-1106-preview",
  "messages": [
    {
      "role": "user",
      "content": "帮我查一下上下五千年这本书" // Translates to: "Help me check the book 'Shang Xia Wu Qian Nian'"
    }
  ],
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "library_book_search",
        "description": "Search for a book in the library database using the book's title",
        "parameters": {
          "type": "object",
          "properties": {
            "book_title": {
              "type": "string",
              "description": "The title of the book to search for in the library."
            }
          },
          "required": ["book_title"]
        }
      }
    }
  ],
  "tool_choice": "auto"
}

Expected Behavior:

  • The book_title parameter should be set to the title of the book mentioned in the user’s input (in this case, “上下五千年”).

Actual Behavior:

  • The book_title parameter is set to "\n".

I’m looking for insights or suggestions on how to resolve this issue. It seems like there’s a problem with parsing or extracting the book title from the Chinese input. Any advice or similar experiences shared would be greatly appreciated!

Thank you in advance!