Free Text Response: Streaming

Free text response provides natural, conversational-style answers to your queries. It is ideal for general Q&A and scenarios where a narrative or contextualized explanation is needed. Streaming the response gives makes it faster and gives the chatbot effect of the system typing out the answer for you

Request Example

from wetro import Wetrocloud

# Initialize the Wetrocloud client
client = Wetrocloud(api_key="your_api_key")

# Query the collection with streaming
streaming_response = client.collection.query_collection(
    collection_id="my_unique_collection_id",
    request_query="What are the sales trends for Q1?",
    stream=True
)

# Process streaming response
for chunk in streaming_response:
    print(chunk.response, end="")
Note: If you are not familiar with streaming, the response is returned in chunks, so your have to loop through the response to get its full content.

Process streaming response

# Process streaming response
for chunk in streaming_response:
    print(chunk.response, end="")

Response Example

FieldDescription
responseConversational response to the query.
tokensNumber of tokens used for processing.
successIndicates whether the query was successful.