Currently, we cannot enable stream if setting output schema. Eg:
from typing import List
import promptulate as pne
from pydantic import BaseModel, Field
class LLMResponse(BaseModel):
provinces: List[str] = Field(description="All provinces in China")
response: LLMResponse = pne.chat(
messages="Please tell me all provinces in China.",
output_schema=LLMResponse,
model="gpt-4-1106-preview",
stream=True,
)
print(response.provinces)
Need to build a json parser to parse stream type json data like this:
๐ Feature Request
Currently, we cannot enable stream if setting output schema. Eg:
Need to build a json parser to parse stream type json data like this: