Files
ragflow/conf/models/stepfun.json
tmimmanuel 558ea51a0f Go: implement provider: StepFun (#14815)
### What problem does this PR solve?

Add a Go driver for StepFun (阶跃星辰), one of the unchecked providers on
the umbrella tracking issue #14736.

Until this PR, a tenant who configured `stepfun` as a model provider in
the Go layer fell through to the default branch of
`internal/entity/models/factory.go` and got the dummy driver. Chat, list
models, and check connection all returned `"not implemented"` instead of
reaching the StepFun API.

The Python side has had StepFun registered in `rag/llm/__init__.py` as a
`SupportedLiteLLMProvider` with base URL `https://api.stepfun.com/v1`,
plus `StepFunCV` for vision and `StepFunSeq2txt` for ASR, but no Go
path. StepFun's chat API is OpenAI-compatible, so the implementation
pattern is the same as the merged Moonshot driver (#14433) and OpenAI
driver (#14605).

### What this PR includes

- New file `internal/entity/models/stepfun.go` with a `StepFunModel`
that implements the `ModelDriver` interface.
- `factory.go`: route the `"stepfun"` provider name to
`NewStepFunModel`.
- New `conf/models/stepfun.json` with the public StepFun chat models
(step-2-16k, step-1 family in 8k/32k/128k/256k context lengths,
step-1-flash, and the step-1v / step-1o vision models) and `url_suffix`
entries for `chat` and `models`.

### How the driver works

- StepFun exposes the OpenAI-compatible API at
`https://api.stepfun.com/v1`.
- `ChatWithMessages` and `ChatStreamlyWithSender` post to
`/chat/completions` in the same shape as the merged moonshot,
openrouter, and openai drivers.
- `ListModels` and `CheckConnection` call `/models` to list available
ids and confirm the API key works.
- `Embed` is left as `"not implemented"`. StepFun has not advertised a
public embeddings endpoint in the API reference linked from the umbrella
issue
(`https://platform.stepfun.com/docs/en/api-reference/chat/chat-completion-create`
is the chat endpoint), so any real implementation belongs in a separate
follow-up only after the endpoint is verified.
- `Rerank` and `Balance` return `"no such method"` because StepFun does
not expose either.

### Type of change

- [x] New Feature (non-breaking change which adds functionality)

### How was this tested?

- `go build ./internal/entity/models/...` returns exit 0 with no errors
on go 1.25 (the `go.mod` minimum).
- Method set of `StepFunModel` matches the `ModelDriver` interface:
`NewInstance`, `Name`, `ChatWithMessages`, `ChatStreamlyWithSender`,
`Embed`, `Rerank`, `ListModels`, `Balance`, `CheckConnection`.
- Pattern parity with the merged moonshot (#14433), openai (#14605),
openrouter (#14652), and xai (#14550) drivers.

Closes #14814
Tracking: #14736
2026-05-12 13:49:35 +08:00

94 lines
1.5 KiB
JSON

{
"name": "StepFun",
"url": {
"default": "https://api.stepfun.ai/v1"
},
"url_suffix": {
"chat": "chat/completions",
"models": "models"
},
"class": "step",
"models": [
{
"name": "step-3.5-flash",
"max_tokens": 32768,
"model_types": [
"chat"
]
},
{
"name": "step-3.5-flash-paid",
"max_tokens": 32768,
"model_types": [
"chat"
]
},
{
"name": "step-2-16k",
"max_tokens": 16384,
"model_types": [
"chat"
]
},
{
"name": "step-1-256k",
"max_tokens": 262144,
"model_types": [
"chat"
]
},
{
"name": "step-1-128k",
"max_tokens": 131072,
"model_types": [
"chat"
]
},
{
"name": "step-1-32k",
"max_tokens": 32768,
"model_types": [
"chat"
]
},
{
"name": "step-1-8k",
"max_tokens": 8192,
"model_types": [
"chat"
]
},
{
"name": "step-1-flash",
"max_tokens": 8192,
"model_types": [
"chat"
]
},
{
"name": "step-1v-32k",
"max_tokens": 32768,
"model_types": [
"chat",
"vision"
]
},
{
"name": "step-1v-8k",
"max_tokens": 8192,
"model_types": [
"chat",
"vision"
]
},
{
"name": "step-1o-vision-32k",
"max_tokens": 32768,
"model_types": [
"chat",
"vision"
]
}
]
}