Skip to content

[Feature Request]: Implement ChatWithMessages in the Jina Go driver #14933

@AlexDev901

Description

@AlexDev901

Self Checks

  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (Language Policy).
  • Non-english title submitions will be closed directly ( 非英文标题的提交将会被直接关闭 ) (Language Policy).
  • Please do not modify this template :) and fill in all the required fields.

Is your feature request related to a problem?

Yes. The Jina Go model driver was added in #14838 with embeddings, rerank, model listing, and connection checking, but chat is still stubbed:

- `JinaModel.ChatWithMessages` returns `jina does not implement ChatWithMessages(not available for now)`.
- `JinaModel.ChatStreamlyWithSender` returns `jina does not implement ChatStreamlyWithSender(not available for now)`.

The configuration already includes `url_suffix.chat = "chat/completions"`, and Jina's current OpenAPI schema exposes `POST /v1/chat/completions` as an experimental chat completions endpoint for `jina-vlm` in OpenAI-compatible format. The public model list also includes `jina-ai/jina-vlm` with text/image input and text output.

I searched existing open and closed issues/PRs for Jina chat, Jina DeepSearch, jina-vlm, and Jina ChatWithMessages. I found the merged provider PR #14838, but no issue or open PR specifically tracking chat support for the Jina Go driver.

Describe the feature you'd like

Implement chat support in internal/entity/models/jina.go for Jina's OpenAI-compatible chat completions endpoint.

The driver should:

  • Implement JinaModel.ChatWithMessages using ${BaseURL}/${URLSuffix.Chat}.
  • Send Authorization: Bearer <api_key> and Content-Type: application/json.
  • Validate apiConfig, apiConfig.ApiKey, modelName, and non-empty messages before dereferencing pointers or sending the request.
  • Build the standard chat completion request body with model, messages, and supported chat config fields such as stream, temperature, max_tokens, top_p, and stop where applicable.
  • Parse the first response choice into ChatResponse.Answer using the same pattern as the other OpenAI-compatible Go providers.
  • Add the jina-ai/jina-vlm chat model entry to conf/models/jina.json so users can select it as a chat-capable model.
  • Add focused unit tests around request construction, auth header, response parsing, validation errors, and non-200 provider errors.

Streaming chat can either be implemented in the same PR if the endpoint supports SSE responses reliably, or left as a clearly documented follow-up if only non-streaming chat is considered stable enough.

Describe implementation you've considered

The implementation can follow the existing OpenAI-compatible provider patterns in the Go model layer, especially the request/response handling used by providers with chat/completions suffixes.

A compact implementation should only need:

  • conf/models/jina.json
  • internal/entity/models/jina.go
  • internal/entity/models/jina_test.go

No factory or interface changes should be necessary because the Jina provider is already registered.

Documentation, adoption, use case

Use case: a tenant configures the Jina provider and wants to use Jina's VLM through the Go model layer for chat/image-understanding workflows. Today, the model provider can list models and can run embeddings/reranking, but chat requests fail immediately because the Go driver returns the stubbed not-implemented error.

This would make the Jina Go provider more complete and consistent with the ongoing Go model provider implementation work tracked in #14736.

Additional information

Relevant current code/config:

- `internal/entity/models/jina.go`: `ChatWithMessages` and `ChatStreamlyWithSender` are stubs.
- `conf/models/jina.json`: already has `url_suffix.chat = "chat/completions"` but no chat model entry.
- Jina OpenAPI currently exposes `POST /v1/chat/completions` and describes it as experimental, OpenAI-compatible chat completions for jina-vlm.
- `GET https://api.jina.ai/v1/models` lists `jina-ai/jina-vlm` with text/image input and text output.

Metadata

Metadata

Assignees

No one assigned

    Labels

    💞 featureFeature request, pull request that fullfill a new feature.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions