Skip to content

Add a Cohere LLM adapter #7

@jstuart0

Description

@jstuart0

Goal

Ship a Cohere adapter (command-r, command-r-plus) for users who prefer Cohere's RAG-friendly models.

Background

Same shape as issue #1 (Mistral). Cohere has its own Chat API that's JSON-ish but structurally different from OpenAI's chat completions — it uses `{"message": "...", "chat_history": [...]}` and the response shape is `{"text": "..."}` instead of a choices array.

Where to start

  • `src/server/services/ai/llm/cohere.ts` — implement `createCohereAdapter({ apiKey })`.
  • Translate our `LlmRequest.transcriptPrompt` into a Cohere message + systemPrompt → `preamble`.
  • Add `"cohere"` to `ProviderKind` + pricing table.

Acceptance criteria

  • Configured Cohere provider passes a watcher run end-to-end.
  • Handles Cohere's error shape (`{"message": "error body"}`).
  • Tests mock the `/chat` endpoint covering happy-path + non-200.

Extra credit: implement `completeStream()` (Cohere streams with SSE-ish `event: text-generation` deltas) so the Ask assistant benefits from it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ai-providerLLM provider adapters (Anthropic, OpenAI, Ollama, etc.)enhancementNew feature or requestgood first issueGood for newcomers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions