posit-dev / posit-dev/querychat

An error occurs in the Viz tool's chart interpretation when using OpenAI's gpt-5.x.

Open
#242 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
212
Forks
29
Avg merge
22h 24m
Merged PRs (30d)
27

Description

Thank you for creating such a great package :)

When using the gemini-3-flash-preview:cloud model in ollama, chart interpretation worked well.

However, when using OpenAI's gpt-5.x model, an error occurs.

I would appreciate it if you could fix this.

< code >
from pathlib import Path

from shiny import App, ui
from querychat import QueryChat
from querychat.data import titanic
from chatlas import ChatAzureOpenAICompletions

llm = ChatAzureOpenAICompletions(
api_key="",
endpoint="
",
deployment_id="gpt-5.5",
api_version="2025-04-01-preview",
)

qc = QueryChat(
titanic,
"titanic",
client=llm,
tools=("query", "visualize"),
prompt_template=Path("prompt.md"),
)

app_ui = ui.page_fluid(qc.ui())

def server(input, output, session):
qc.server()

app = App(app_ui, server)

< Error >
('Error in Chat('querychat_CSCM_SALES_PSI_PV-chat'): Error code: 400 - {'error': {'message': "An assistant message with 'tool_calls' must be followed by tool messages responding to each 'tool_call_id'. The following tool_call_ids did not have response messages: call_RB81n3Dp1VpIsCXZ3bGfHpKp", 'type': 'invalid_request_error', 'param': 'messages.[7].role', 'code': None}}', False, False)

Image

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the provided Python setup through QueryChat with tools=("query", "visualize") and qc.server(), using ChatAzureOpenAICompletions with the gpt-5.x deployment. Trace the chart interpretation path and its tool-call message handling based on the reported missing tool response. Done means gpt-5.x completes chart interpretation without the 400 error, while the working Ollama model remains functional.

Written by the indexing model from the issue text.

Assessment

Tech stack
ollama, python
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.