JSON schema
1. Use Cases
Currently, the SiliconCloud large model API platform defaults to generating unstructured text. However, in certain use cases, you may want the model to output content in a structured format. However, instructing the large model directly with prompts may not yield the correct structured output.
As a standardized and lightweight data exchange format, the JSON schema is an important feature that supports the large model API to produce structured outputs. When you call the large model’s API to make a request, the model returns results in JSON format, which is easy for humans to read and write, and also easy for machines to parse and generate.
Now, all major language models on the SiliconCloud platform, except for the R1 series and V3 models from DeepSeek, support JSON mode, allowing the model to output JSON-formatted strings to ensure that the model outputs in the expected structure, making it easier to logically parse the output content.
For example, you can now try structured output using the SiliconCloud API for the following cases:
- Building a news database from company-related reports, including news titles and links.
- Extracting sentiment analysis structures from product purchase reviews, including sentiment polarity (positive, negative, neutral), sentiment intensity, and sentiment keywords.
- Extracting product lists from purchase history, including product information, recommendation reasons, prices, and promotional information.
2. Usage
Add in the request:
3. Supported Model List
Currently, online, except for the DeepSeek R1 series and V3 models, all other large language models support the aforementioned parameters.
4. Usage Examples
Below is an example using OpenAI:
The model will output: