Skip to content

Go: implement provider: StepFun - #14815

Merged
JinHai-CN merged 7 commits into
infiniflow:mainfrom
tmimmanuel:go/stepfun-driver
May 12, 2026
Merged

JinHai-CN merged 7 commits into
infiniflow:mainfrom
tmimmanuel:go/stepfun-driver

Conversation

@tmimmanuel

Copy link
Copy Markdown
Contributor

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

  • New Feature (non-breaking change which adds functionality)

How was this tested?

Closes #14814
Tracking: #14736

@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label May 12, 2026
@coderabbitai

coderabbitai Bot commented May 12, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 684dcaa3-7d19-467a-bff3-ccdfb172e755

📥 Commits

Reviewing files that changed from the base of the PR and between 2a9cb2d and 26fabd6.

📒 Files selected for processing (1)
  • conf/models/stepfun.json
✅ Files skipped from review due to trivial changes (1)
  • conf/models/stepfun.json

📝 Walkthrough

Walkthrough

Adds StepFun provider config, registers "stepfun" in the model factory, and implements StepFunModel with sync chat, SSE streaming chat, model listing, and connection verification; embeds/rerank/balance are stubbed.

Changes

StepFun Model Provider Integration

Layer / File(s) Summary
Provider Configuration
conf/models/stepfun.json
Defines StepFun provider metadata, base URL, endpoint suffixes, and supported models with max_tokens and model_types.
Factory Routing
internal/entity/models/factory.go
Routes provider name "stepfun" to NewStepFunModel(baseURL, urlSuffix).
Driver Type and Constructor
internal/entity/models/stepfun.go (lines 1–69)
Defines StepFunModel struct, constructor tuning HTTP transport and client, and stores region-aware base URL and URL suffix config.
Instance, Name, and Region Helpers
internal/entity/models/stepfun.go (lines 71–90)
Implements NewInstance, Name, and baseURLForRegion helper to select/validate region endpoints.
Chat Methods (sync & SSE)
internal/entity/models/stepfun.go (lines 91–364)
ChatWithMessages: validates inputs and API key, builds request, POSTs to /chat/completions, enforces 200 OK, parses JSON and returns first choice content. ChatStreamlyWithSender: enforces stream:true, POSTs for SSE, parses data: JSON events, forwards delta.content chunks to sender, detects terminal state, and emits final [DONE].
Model Discovery & Connection
internal/entity/models/stepfun.go (lines 373–453)
ListModels GETs /models, parses data[].id entries; CheckConnection delegates to ListModels.
Unsupported Methods / Stubs
internal/entity/models/stepfun.go (lines 366–371, 455–459)
Embed returns "not implemented"; Balance and Rerank return "no such method" stubs.

Sequence Diagram

sequenceDiagram
  participant Client
  participant StepFun as StepFunModel
  participant API as StepFun API

  Client->>StepFun: ChatWithMessages(modelName, messages, config)
  StepFun->>StepFun: Validate API key
  StepFun->>StepFun: Select region URL
  StepFun->>API: POST /v1/chat/completions
  API-->>StepFun: 200 OK with choices
  StepFun->>Client: ChatResponse

  Client->>StepFun: ChatStreamlyWithSender(modelName, messages, sender)
  StepFun->>StepFun: Validate and set stream true
  StepFun->>API: POST /v1/chat/completions
  API-->>StepFun: 200 OK SSE stream
  loop Each event
    API-->>StepFun: data: {"delta": {"content": "..."}}
    StepFun->>Client: forward via sender
  end
  API-->>StepFun: data: [DONE]
  StepFun->>Client: send DONE sentinel
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

🐰 I hopped in code through StepFun's gate,
New models queued and endpoints wait,
Streams that trickle, chats that bloom,
Sender sings each small content plume,
Hooray — the driver joins the crate!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Go: implement provider: StepFun' directly and clearly summarizes the main change—adding a Go driver implementation for the StepFun provider.
Description check ✅ Passed The PR description fully follows the template structure with 'What problem does this PR solve?' and 'Type of change' sections completed, providing comprehensive context and implementation details.
Linked Issues check ✅ Passed The PR implementation meets all coding requirements from issue #14814: StepFunModel implements the complete ModelDriver interface, factory.go routes 'stepfun' correctly, and stepfun.json defines models with proper configuration.
Out of Scope Changes check ✅ Passed All changes are directly in scope—new StepFun driver implementation, factory routing, and model configuration align precisely with issue #14814 objectives.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/entity/models/stepfun.go`:
- Around line 101-104: The code currently treats an empty string as an explicit
region which breaks lookups; update the region selection in both
ChatWithMessages and ListModels to use "default" when apiConfig.Region is nil or
when the pointer references an empty string (i.e., set region := "default"; if
apiConfig.Region != nil && *apiConfig.Region != "" { region = *apiConfig.Region
}), and apply the identical change in the other occurrence to ensure
empty-string regions fall back to "default".
- Line 210: The ChatStreamlyWithSender method currently calls the sender
callback unconditionally; add a defensive nil check at the start of
ChatStreamlyWithSender (alongside the existing checks for messages and
apiConfig) and return an error if sender == nil to avoid a runtime panic when
sender is invoked later in the function; reference the ChatStreamlyWithSender
function and ensure the guard uses the same error-reporting style/pattern as the
other parameter checks in this file.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c3d20466-1e23-4024-82b0-45170c26490c

📥 Commits

Reviewing files that changed from the base of the PR and between 2f2d156 and e514892.

📒 Files selected for processing (3)
  • conf/models/stepfun.json
  • internal/entity/models/factory.go
  • internal/entity/models/stepfun.go

Comment thread internal/entity/models/stepfun.go Resolved
Comment thread internal/entity/models/stepfun.go Resolved
CodeRabbit review on infiniflow#14815 flagged two issues:

- ChatWithMessages and ListModels treated a non-nil but empty Region
  pointer as an explicit region, which then failed baseURLForRegion
  lookup despite a valid "default" entry. Match the guard already used
  in ChatStreamlyWithSender: only override "default" when the region
  string is non-empty.
- ChatStreamlyWithSender did not validate that sender was non-nil
  before invoking it inside the scan loop, which would panic on a
  nil callback. Add the guard alongside the existing messages and
  api-key checks.
tmimmanuel added a commit to tmimmanuel/ragflow that referenced this pull request May 12, 2026
CodeRabbit review on this PR flagged two issues that match the ones
also addressed in the Mistral driver (infiniflow#14805) and StepFun (infiniflow#14815).

- ChatWithMessages and ListModels treated a non-nil but empty Region
  pointer as an explicit region, which then failed baseURLForRegion
  lookup despite a valid "default" entry. Match the guard already used
  in ChatStreamlyWithSender: only override "default" when the region
  string is non-empty.
- ChatStreamlyWithSender did not validate that sender was non-nil
  before invoking it inside the scan loop, which would panic on a
  nil callback. Add the guard alongside the existing messages and
  api-key checks.
Comment thread conf/models/stepfun.json Resolved
@Haruko386 Haruko386 added the ci Continue Integration label May 12, 2026
CodeRabbit caught that conf/models/stepfun.json shipped with
https://api.stepfun.com/v1, which resolves to StepFun's domestic
deployment behind the VolcEngine WAF (Chinese ByteDance infra). The
canonical international endpoint is https://api.stepfun.ai/v1, which
resolves to the Aliyun international ALB in us-east-1. Both backends
serve the same OpenAI-compatible surface, but keys issued by the .ai
side are rejected by the .com side with the same generic
"Incorrect API key provided" error, which masks the mismatch.

Confirmed live: the same test API key returns HTTP 401 against
api.stepfun.com/v1/models and HTTP 200 with the account's real
model list against api.stepfun.ai/v1/models. Chat completion then
returns 402 quota_exceeded against .ai, which proves the auth path
works end to end and the only remaining gate is account credit.

Also add step-3.5-flash and step-3.5-flash-paid to the model list.
Those are the current flagship chat models on the .ai deployment
(visible in /v1/models for accounts that exist today), so a tenant
who opens the model picker after this lands sees a working pick by
default. Keep the step-1 and step-1v entries for accounts that
still have access to the older lineup.
@tmimmanuel

Copy link
Copy Markdown
Contributor Author

Live integration test against api.stepfun.ai (URL fix verified)

Ran a TestStepFunSmoke (not committed; same pattern as the Upstage and LocalAI smoke tests) against the live .ai deployment with the same key that returned 401 against the old .com URL. Chat completion is billing-gated on this account (HTTP 402), but the auth + URL + ListModels paths are fully verified on the wire.

Result

$ STEPFUN_KEY=<redacted> go test -vet=off -run TestStepFunSmoke -timeout 60s -v ./internal/entity/models/...
=== RUN   TestStepFunSmoke
    stepfun_smoke_test.go:33: [OK] driver.Name() = "stepfun"
    stepfun_smoke_test.go:38: [OK] CheckConnection
    stepfun_smoke_test.go:47: [OK] ListModels returned 7 ids: [step-tts-2 step-3.5-flash step-3.5-flash-paid step-3.5-flash-2603 stepaudio-2.5-tts stepaudio-2.5-asr step-image-edit-2]
    stepfun_smoke_test.go:63:        chat model = "step-3.5-flash"
    stepfun_smoke_test.go:74: [OK auth+URL] ChatWithMessages: API request failed with status 402: {"error":{"message":"You exceeded your current quota, please check your plan and billing details","type":"quota_exceeded"}}
    stepfun_smoke_test.go:92: [OK auth+URL] ChatStreamlyWithSender: API request failed with status 402: {"error":{"message":"You exceeded your current quota, please check your plan and billing details","type":"quota_exceeded"}}
    stepfun_smoke_test.go:100: [OK] Balance returns no such method
    stepfun_smoke_test.go:107: [OK] Rerank returns no such method
    stepfun_smoke_test.go:113: [OK] Embed (stub) returns not implemented

STEPFUN SMOKE PASSED (chat may be billing-gated; auth + URL verified)
--- PASS: TestStepFunSmoke (0.82s)
PASS
ok      ragflow/internal/entity/models  0.842s

What this proves

  • api.stepfun.ai/v1 is reachable and serves the expected OpenAI-compatible surface.
  • /v1/models returns this account's actual model lineup — three step-3.5-flash* chat models plus TTS/ASR/image. The driver's ListModels parser handles the live response shape.
  • Auth header is correctly formatted (Bearer <key>): the chat endpoint accepts the request all the way to the billing check before rejecting with 402 quota_exceeded. A wrong-URL or wrong-auth request would have failed with 401 invalid_api_key or 404 (which is what was happening before the URL fix).
  • Balance / Rerank return the documented no such method sentinels.
  • Embed returns the documented not implemented stub.

Boundary not yet verified

The chat-response JSON parser (choices[0].message.content) is exercised only by the unit-test mock so far, not against a real StepFun response, because chat is billing-gated on this account. Same parser is used by the merged OpenAI / Moonshot / OpenRouter / Upstage drivers though, all of which run against live OpenAI-compatible servers in their respective PRs, so the wire-shape risk on that one cell is low.

Smoke test file was not committed.

@codecov

codecov Bot commented May 12, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.16%. Comparing base (2f2d156) to head (26fabd6).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #14815      +/-   ##
==========================================
- Coverage   95.59%   94.16%   -1.43%     
==========================================
  Files          10       10              
  Lines         703      703              
  Branches      112      112              
==========================================
- Hits          672      662      -10     
- Misses         21       25       +4     
- Partials       10       16       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tmimmanuel

Copy link
Copy Markdown
Contributor Author

The ragflow_tests failure here is unrelated to this PR's diff — it's a flake in the Python SDK suite. The failing test in this run was:

FAILED test/testcases/test_sdk_api/test_file_management_within_dataset/test_parse_documents.py
::TestDocumentsParse::test_basic_scenarios[<lambda>-1] - AssertionError: Document parsing timeout

That test waits for the document-parsing pipeline (OCR + chunker) to finish within a fixed timeout. When the CI runner is under load the parser overruns the wait window and the test fails with the generic "Document parsing timeout" assertion. Nothing in this PR touches:

  • The document-parsing pipeline
  • The Python SDK
  • Anything outside conf/models/stepfun.json + the Go stepfun.go source

The 741 passed / 1 failed / 37 skipped split is consistent with a one-off timeout, not a regression. Could a maintainer re-run the failed job? I tried gh run rerun --failed from my side but the API rejected it ("cannot be rerun"), which is expected since the run is on the upstream repo where I don't have rerun rights.

@Haruko386 Haruko386 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @tmimmanuel LGTM
Thank you for your contribution.

@JinHai-CN
JinHai-CN merged commit 558ea51 into infiniflow:main May 12, 2026
1 of 2 checks passed
tmimmanuel added a commit to tmimmanuel/ragflow that referenced this pull request May 12, 2026
LongCat (Meituan, https://longcat.chat) is one of the unchecked
providers on the umbrella tracking issue infiniflow#14736. Its API is
OpenAI-compatible at https://api.longcat.chat/openai/v1 with three
public chat models: LongCat-Flash-Chat, LongCat-Flash-Lite, and
LongCat-Flash-Thinking (a reasoning model).

What this PR includes:

- internal/entity/models/longcat.go: full driver implementing the
  ModelDriver interface
- conf/models/longcat.json: base URL + url_suffix + the 3 public
  models
- factory.go: route "longcat" provider name to NewLongCatModel
- internal/entity/models/longcat_test.go: 21 unit tests

Methods:

- ChatWithMessages         non-stream chat
- ChatStreamlyWithSender   SSE streaming chat
- ListModels / CheckConnection
- reasoning_content extraction on both stream and non-stream paths
  (LongCat-Flash-Thinking returns the chain-of-thought in
  message.reasoning_content / delta.reasoning_content, OpenAI
  o-series shape; live-probed before writing tests)
- reasoning_effort propagation from ChatConfig.Effort
- Embed / Rerank / Balance / TranscribeAudio / AudioSpeech / OCRFile
  return the "no such method" sentinel (LongCat does not expose any
  of these surfaces)

Pattern parity with the merged Mistral (infiniflow#14807), Upstage (infiniflow#14819),
and StepFun (infiniflow#14815) drivers. No interface change.

Verified live against api.longcat.chat:
- ListModels: 5 ids (Flash-Lite, Flash-Chat, Flash-Thinking-2601,
  Flash-Omni-2603, 2.0-Preview)
- Chat (Flash-Chat) non-stream: "Got it! Let me know if you..."
- Chat (Flash-Thinking) non-stream: 443-char answer + 557-char
  reasoning trace extracted into ChatResponse.ReasonContent
- Stream (Flash-Thinking): 78 content chunks (351 chars) + 107
  reasoning chunks (537 chars) — the delta.reasoning_content
  extraction works end to end against real wire data
- Sentinels all return "no such method"

21 unit tests pass on go 1.25; build clean.

Note on PR history: this branch was previously named for LocalAI
work which has since been consolidated into PR infiniflow#14813. The branch
was reset to upstream/main and rebuilt for LongCat — diff is a
clean +1052 lines on top of current main.
tmimmanuel added a commit to tmimmanuel/ragflow that referenced this pull request May 14, 2026
CodeRabbit review on infiniflow#14815 flagged two issues:

- ChatWithMessages and ListModels treated a non-nil but empty Region
  pointer as an explicit region, which then failed baseURLForRegion
  lookup despite a valid "default" entry. Match the guard already used
  in ChatStreamlyWithSender: only override "default" when the region
  string is non-empty.
- ChatStreamlyWithSender did not validate that sender was non-nil
  before invoking it inside the scan loop, which would panic on a
  nil callback. Add the guard alongside the existing messages and
  api-key checks.
tmimmanuel added a commit to tmimmanuel/ragflow that referenced this pull request May 14, 2026
LongCat (Meituan, https://longcat.chat) is one of the unchecked
providers on the umbrella tracking issue infiniflow#14736. Its API is
OpenAI-compatible at https://api.longcat.chat/openai/v1 with three
public chat models: LongCat-Flash-Chat, LongCat-Flash-Lite, and
LongCat-Flash-Thinking (a reasoning model).

What this PR includes:

- internal/entity/models/longcat.go: full driver implementing the
  ModelDriver interface
- conf/models/longcat.json: base URL + url_suffix + the 3 public
  models
- factory.go: route "longcat" provider name to NewLongCatModel
- internal/entity/models/longcat_test.go: 21 unit tests

Methods:

- ChatWithMessages         non-stream chat
- ChatStreamlyWithSender   SSE streaming chat
- ListModels / CheckConnection
- reasoning_content extraction on both stream and non-stream paths
  (LongCat-Flash-Thinking returns the chain-of-thought in
  message.reasoning_content / delta.reasoning_content, OpenAI
  o-series shape; live-probed before writing tests)
- reasoning_effort propagation from ChatConfig.Effort
- Embed / Rerank / Balance / TranscribeAudio / AudioSpeech / OCRFile
  return the "no such method" sentinel (LongCat does not expose any
  of these surfaces)

Pattern parity with the merged Mistral (infiniflow#14807), Upstage (infiniflow#14819),
and StepFun (infiniflow#14815) drivers. No interface change.

Verified live against api.longcat.chat:
- ListModels: 5 ids (Flash-Lite, Flash-Chat, Flash-Thinking-2601,
  Flash-Omni-2603, 2.0-Preview)
- Chat (Flash-Chat) non-stream: "Got it! Let me know if you..."
- Chat (Flash-Thinking) non-stream: 443-char answer + 557-char
  reasoning trace extracted into ChatResponse.ReasonContent
- Stream (Flash-Thinking): 78 content chunks (351 chars) + 107
  reasoning chunks (537 chars) — the delta.reasoning_content
  extraction works end to end against real wire data
- Sentinels all return "no such method"

21 unit tests pass on go 1.25; build clean.

Note on PR history: this branch was previously named for LocalAI
work which has since been consolidated into PR infiniflow#14813. The branch
was reset to upstream/main and rebuilt for LongCat — diff is a
clean +1052 lines on top of current main.
tmimmanuel added a commit to tmimmanuel/ragflow that referenced this pull request May 14, 2026
CodeRabbit review on this PR flagged two issues that match the ones
also addressed in the Mistral driver (infiniflow#14805) and StepFun (infiniflow#14815).

- ChatWithMessages and ListModels treated a non-nil but empty Region
  pointer as an explicit region, which then failed baseURLForRegion
  lookup despite a valid "default" entry. Match the guard already used
  in ChatStreamlyWithSender: only override "default" when the region
  string is non-empty.
- ChatStreamlyWithSender did not validate that sender was non-nil
  before invoking it inside the scan loop, which would panic on a
  nil callback. Add the guard alongside the existing messages and
  api-key checks.
@coderabbitai coderabbitai Bot mentioned this pull request Jun 4, 2026
1 of 2 tasks
Ricardo-M-L pushed a commit to Ricardo-M-L/ragflow that referenced this pull request Aug 17, 2026
### What problem does this PR solve?

Add a Go driver for StepFun (阶跃星辰), one of the unchecked providers on
the umbrella tracking issue infiniflow#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 (infiniflow#14433) and OpenAI
driver (infiniflow#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 (infiniflow#14433), openai (infiniflow#14605),
openrouter (infiniflow#14652), and xai (infiniflow#14550) drivers.

Closes infiniflow#14814
Tracking: infiniflow#14736
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request]: Add Go driver for StepFun model provider

3 participants