Installation
Basic usage
The following code demonstrates how to use the SambaCloud API with Instructor to generate structured output from theMeta-Llama-3.1-405B-Instruct
model. A User
schema is defined using Pydantic, requiring the model to return a response with a name
(string) and age
(integer). Instructor handles the response validation and parsing, resulting in a structured Python object.
Async usage
This code also uses SambaCloud API with Instructor to enforce structured output. The result is fetched asynchronously and printed, outputtingUser(name='Ivan', age=28')
.