Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Calls with json_format=True yields double sets of curly braces #456

Open
2 tasks done
evdevdev opened this issue Feb 7, 2025 · 0 comments
Open
2 tasks done
Labels
bug Something isn't working status:needs-triage An issue that needs to be triaged by the Pinecone team

Comments

@evdevdev
Copy link

evdevdev commented Feb 7, 2025

Is this a new bug?

  • I believe this is a new bug
  • I have searched the existing Github issues and Community Forum, and I could not find an existing post for this bug

Describe the bug
I am attempting to use json_format=True. About one in every 20 or so calls will yield invalid JSON. Specifically it gives double curly braces.

Example code:

msg = Message(role="user", content=content)
response = assistant.chat(messages=[msg], model=model, json_response=True)
# vanilla use of pydantic; the error occurs here
evidence_evaluation = EvidenceEvaluation.model_validate_json(
    response.message.content
)

Expected response:
{"first_key": "Example", "second_key": "Example again."}

Actual response (about one in every 20 times):
{{"first_key": "Example", "second_key": "Example again."}}

Error information

Invalid JSON: key must be a string at line 1 column 2 [type=json_invalid, input_value='{{"first_key": "Example", "second_key": "Example again."}}`

It's worth noting that the double curlies happen at start and end.

Steps to reproduce the issue locally
Call the above code about 20-30 times. It will randomly happen.

Environment

  • OS Version: Sequoia 15.3
  • Python version: 3.13.1
  • Python SDK version: 5.4.2

Additional context
Add any other context about the problem here.

@evdevdev evdevdev added the bug Something isn't working label Feb 7, 2025
@github-actions github-actions bot added the status:needs-triage An issue that needs to be triaged by the Pinecone team label Feb 7, 2025
@evdevdev evdevdev changed the title [Bug] [Bug] Calls with json_format=True. yield double sets of curly braces Feb 7, 2025
@evdevdev evdevdev changed the title [Bug] Calls with json_format=True. yield double sets of curly braces [Bug] Calls with json_format=True yields double sets of curly braces Feb 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working status:needs-triage An issue that needs to be triaged by the Pinecone team
Projects
None yet
Development

No branches or pull requests

1 participant