Similar to validator a converter can be passed and if so it will be called on output and added to the result field of the SpiceResponse. Example of use:
import asyncio
from spice import Spice, print_stream
client = Spice()
a = asyncio.run(client.get_response([{"role":"user", "content": "what is your favorite number? Please respond with just one two digit number. This is a test of your ability to follow instructions"}], model="gpt-3.5-turbo", retries=2, streaming_callback=print_stream))
a.text # '42'
a.result # 42
I want to use this with pydantic models and their parse_raw class method.
Similar to validator a converter can be passed and if so it will be called on output and added to the result field of the SpiceResponse. Example of use:
I want to use this with pydantic models and their
parse_raw
class method.