Skip to content
This repository was archived by the owner on Jun 5, 2025. It is now read-only.
This repository was archived by the owner on Jun 5, 2025. It is now read-only.

Receiving a null value in the content field #799

Description

@dussab

Describe the issue

I'm building a client application that calls through CodeGate and out to OpenAI. If I send a prompt through my client app with the text "Codegate version" a null is retuned. If send a prompt that isn't related to CodeGate (e.g. what is my name) i get a the following response.

On the failed (null) response i see the following json:

{
 "id": "pipeline-codegate-cli-1738105991",
 "created": 1738105991,
 "model": "gpt-4o-mini",
 "object": "chat.completion",
 "system_fingerprint": null,
 "choices": [
   {
     **"text": "CodeGate version: v0.1.14",**
     "finish_reason": "stop",
     "index": 0,
     "message": {
       **"content": null,**
       "role": "assistant",
       "tool_calls": null,
       "function_call": null
     }
   }
 ],
 "usage": {
   "completion_tokens": 0,
   "prompt_tokens": 0,
   "total_tokens": 0,
   "completion_tokens_details": null,
   "prompt_tokens_details": null
 }
}

It looks like the "text": "CodeGate version: v0.1.14", is returning the codegate version number but I'm wondering if it should be in the content field which is currently -> "content": null. It's possible that I need to handle this situation on the client and that this is by design.

Here is a successful response to compare against:

{
  "id": "chatcmpl-Aup48XBfAM4msvRZAI4lwDBPpZOxj",
  "object": "chat.completion",
  "created": 1738106028,
  "model": "gpt-4o-mini-2024-07-18",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        **"content": "It seems like you're testing the functionality. How can I assist you today? If you have any questions or need help with something specific, feel free to ask!",**
        "refusal": null
      },
      "logprobs": null,
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 74,
    "completion_tokens": 33,
    "total_tokens": 107,
    "prompt_tokens_details": {
      "cached_tokens": 0,
      "audio_tokens": 0
    },
    "completion_tokens_details": {
      "reasoning_tokens": 0,
      "audio_tokens": 0,
      "accepted_prediction_tokens": 0,
      "rejected_prediction_tokens": 0
    }
  },
  "service_tier": "default",
  "system_fingerprint": "fp_72ed7ab54c"
}

Steps to Reproduce

Run sample project https://github.com/StacklokLabs/spring-ai-codegate-sample/tree/main/sample

Operating System

MacOS (Arm)

IDE and Version

Vscode

Extension and Version

NA

Provider

OpenAI

Model

gpt-4o-mini

Codegate version

v0.1.14

Logs

Here are the CodeGate logs from the response returning null:

2025-01-28 15:00:15 2025-01-28T20:00:15.649744Z [debug    ] User-Agent header received: Java-http-client/23.0.1 from 172.17.0.1 lineno=45 module=server pathname=/app/src/codegate/server.py
2025-01-28 15:00:15 2025-01-28T20:00:15.655106Z [info     ] Chat completion pipeline selected for execution. lineno=120 module=base pathname=/app/src/codegate/providers/base.py
2025-01-28 15:00:15 2025-01-28T20:00:15.658325Z [info     ] Total secrets redacted since last assistant message: 0 lineno=298 module=secrets pathname=/app/src/codegate/pipeline/secrets/secrets.py
2025-01-28 15:00:15 2025-01-28T20:00:15.684066Z [info     ] Recorded context in DB. Output chunks: 1. Alerts: 0. lineno=249 module=connection pathname=/app/src/codegate/db/connection.py
2025-01-28 15:00:15 2025-01-28T20:00:15.684869Z [info     ] 172.17.0.1:61530 - "POST /openai/v1/chat/completions HTTP/1.1" 200 lineno=473 module=h11_impl pathname=/usr/local/lib/python3.12/site-packages/uvicorn/protocols/http/h11_impl.py

Additional Context

No response

Activity

  1. dussab commented on Jan 29, 2025

    @dussab
    MemberAuthor

    I've also noticed that anytime i receive "content": null, , the prompt and responses don't get logged in the CodeGate portal.

  2. dussab commented on Jan 29, 2025

    @dussab
    MemberAuthor

    Might be related to #542

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions