Skip to main content
Together retired the source’s meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo serverless model. Select a current chat model marked for structured outputs in the Together serverless catalog before running. See Together structured outputs.
structured_output.py

Run the Example

1

Set up your virtual environment

2

Install dependencies

3

Export environment variables

4

Use a structured-output model

Add import os, then replace Together(id="meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo") with Together(id=os.environ["TOGETHER_STRUCTURED_MODEL_ID"]) in the saved file.
5

Run the example

Save the code above as structured_output.py, then run:
Full source: cookbook/90_models/together/structured_output.py