Can't parse JSON body of the request

Created on 1 May 2024, 8 months ago
Updated 23 May 2024, 7 months ago

I don't know if this is an issue with this module or the mothership (Augmentor), but I can't get any non-error responses back from the API call. In the Drupal report log, all errors are like this:

OpenAI API error: We could not parse the JSON body of your request. (HINT: This likely means you aren't using your HTTP library correctly. The OpenAI API expects a JSON payload, but what was sent was not valid JSON. If you have trouble figuring out how to fix this, please contact us through our help center at help.openai.com.).

I believe I have my key set up correctly, and I am using Augmentor Default Widget (source: Title, target: Body) on a fresh Drupal 10.2 site.

The augmentor preview (/admin/config/augmentors) gives the same result :(

What am I missing?

thanks,
-mike

πŸ’¬ Support request
Status

Closed: cannot reproduce

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States ultimike Florida, USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @ultimike
  • πŸ‡―πŸ‡΅Japan eleonel Itoshima πŸ‡―πŸ‡΅

    Could you please share a screenshot of the entire augmentor configuration?

  • πŸ‡ΊπŸ‡ΈUnited States ultimike Florida, USA

    @eleonel - thanks for the quick reply.

    • Augmentor version: 1.1.x-dev (74c3aaa646)
    • ChatGPT Augmentor version: 1.0.x-dev (2e99cf)

    Screenshot:

    Everything in the "Advanced" fieldset is default values.

    thanks,
    -mike

  • πŸ‡―πŸ‡΅Japan eleonel Itoshima πŸ‡―πŸ‡΅

    Hi there, I wasn't able to replicate the issue using:

    • drupal/core (10.2.x-dev)
    • drupal/augmentor (dev-1.1.x 74c3aaa)
    • drupal/augmentor_chatgpt (dev-1.0.x e2153be)

    Could you please upgrading the modules to the latest commits?

  • Status changed to Closed: cannot reproduce 7 months ago
  • πŸ‡―πŸ‡΅Japan eleonel Itoshima πŸ‡―πŸ‡΅
  • πŸ‡ΊπŸ‡ΈUnited States ultimike Florida, USA

    @eleonel Thanks for the assistance.

    After updating everything, I was now able to get a valid response using:

    • API key: OpenAI
    • SDK to use: openai-php/client
    • Model: gpt-4o

    But, when I changed the "SDK to use" to "orhanerday/open-ai", I received the error, "{"error":"Error during the chat completion execution, please check the logs for more information."}". Looking at the log, it has the same error as I originally reported:

    OpenAI API error: We could not parse the JSON body of your request. (HINT: This likely means you aren't using your HTTP library correctly. The OpenAI API expects a JSON payload, but what was sent was not valid JSON. If you have trouble figuring out how to fix this, please contact us through our help center at help.openai.com.).

    So, it looks like it is/was an SDK issue.

    Thanks!

    -mike

Production build 0.71.5 2024