Skip to content

bug: Streaming chat completion API returns empty response with tools #2204

Open
@jkohen

Description

@jkohen

Cortex version

v1.0.12

Describe the issue and expected behaviour

The following code works as expected:

    output = client.chat.completions.create(
        model=session.model_id,
        messages=messages,
        stream=True,
    )
    print(f'Output: {list(output)}')

However, when I add tools=my_tools, the response becomes the empty list. If I then remove stream=True, the response is again correct, only that streaming being disable, it's returned all at once.

I expected stream=True and tools=... to work together as per https://platform.openai.com/docs/guides/function-calling#streaming.

Steps to Reproduce

No response

Screenshots / Logs

No response

What is your OS?

  • Windows
  • Mac Silicon
  • Mac Intel
  • Linux / Ubuntu

What engine are you running?

  • cortex.llamacpp (default)
  • cortex.tensorrt-llm (Nvidia GPUs)
  • cortex.onnx (NPUs, DirectML)

Hardware Specs eg OS version, GPU

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething isn't working

    Type

    No type

    Projects

    Status

    Investigating

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions