cloudwego / cloudwego/eino

Better Support for JSON Format

Open
#883 0 comments 4 reactions 0 assignees View on GitHub
C-feature-request D-chatmodel-impl
Dominant language
Go
Stars
13k
Forks
1.1k
Avg merge
4h 6m
Merged PRs (30d)
41

Description

**Is your feature request related to a problem? Please describe.**

I'm always frustrated when I need to use JSON format output to achieve deterministic function call behavior, such as building a simple scenario classifier. Currently, most AI APIs support JSON Format response, but this feature is not available in enio. This limitation makes it difficult to integrate enio with systems that require structured data output.

**Describe the solution you'd like**

I would like enio to support JSON Format response mode, similar to other AI API providers. This would allow users to:
- Specify a JSON schema for the expected output
- Receive structured, parseable responses consistently
- Use enio for function calling and scenario classification tasks without additional parsing logic

**Describe alternatives you've considered**

1. Using post-processing to parse and validate the response into JSON format - This is unreliable as the model may not always output valid JSON
2. Switching to other API providers that support JSON mode - This defeats the purpose of using enio
3. Implementing custom prompt engineering to encourage JSON output - This doesn't guarantee consistent results

**Additional context**

JSON Format response is becoming a standard feature across AI API providers (OpenAI, Anthropic, etc.) as it enables more reliable integration with downstream systems. This feature would significantly improve enio's usability for production applications that require structured output.

Example use case:
```json
{
"scenario": "customer_support",
"confidence": 0.95,
"category": "billing_inquiry"
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.