Assistant - API : Need help :)

Hello,

My objective to chat with the assistant from Xano. Therefore I used the API documentation found on Pinecone: Chat with an assistant - Pinecone Docs

The response has a status 200 so I understand that works.

The problem is that the answer I get is not what I’d like to see i.e. clear text. Instead I get this (please see below an extract because it goes like that for hundreds of lines).

Could somebody please help me?
thanks

Hi @david_swiss24, thanks for your post. It looks like you are using the chat_assistant endpoint (API Reference).

If you are looking for something similar to the OpenAI Chat Completion API, which is useful for inline citations and OpenAI-compatible responses, check out the chat_completion_assistant endpoint (API Reference).

It also appears you are using streaming. Is this intended, or would you prefer to wait longer and receive the entire message? If the latter applies, you can drop the stream=True parameter and return the full message.

Hi Zeke,
Thank you for your answer.
Streaming is not intended. Where do I insert this parameter within the CURL? (Also, the bold part cannot be imported in the CURL as it seems not valid)

PINECONE_API_KEY=“YOUR_API_KEY”
ASSISTANT_NAME=“example-assistant”

curl --request POST
–url https://prod-1-data.ke.pinecone.io/assistant/chat/$ASSISTANT_NAME/chat/completions
–header ‘Api-Key: $PINECONE_API_KEY’
–header ‘Content-Type: application/json’
–data ‘{
“messages”: [
{
“role”: “user”,
“content”: “What is the maximum height of a red pine?”
}
]
}’

Thank you @zeke_pinecone

@david_swiss24 Thanks for your questions. Please note that we are actively improving the documentation to address these concerns, and we appreciate your outreach, especially during this public preview period.

You must insert the streaming parameter in the data flag. For example:

curl --request POST \
  --url "https://prod-1-data.ke.pinecone.io/assistant/chat/$ASSISTANT_NAME/chat/completions" \
  --header "Api-Key: $PINECONE_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "messages": [
    {
      "role": "user",
      "content": "What is the maximum height of a red pine?"
    }
  ],
  "stream": false
}'

Regarding the environment variables not mapping properly, you need to add double quotes around the values for the url and Api-Key headers to allow the variables to expand properly. We’re fixing this also throughout the docs. Thanks again, and let us know if you have questions!