Skip to content

feat: add OrcaRouter embedding encoder - #4455

Open
bangla24bdrang-lab wants to merge 1 commit into
Unstructured-IO:mainfrom
bangla24bdrang-lab:add-orcarouter-embedder
Open

feat: add OrcaRouter embedding encoder#4455
bangla24bdrang-lab wants to merge 1 commit into
Unstructured-IO:mainfrom
bangla24bdrang-lab:add-orcarouter-embedder

Conversation

@bangla24bdrang-lab

@bangla24bdrang-lab bangla24bdrang-lab commented Aug 27, 2026

Copy link
Copy Markdown

Summary

The unstructured library pre-processes documents for downstream LLM workflows, and its unstructured.embed module exposes embedding encoders so those pipelines can attach vector embeddings to partitioned elements. This PR adds OrcaRouter as a first-class embedding provider, mirroring the existing OctoAI embedder.

OrcaRouter is an OpenAI-compatible AI gateway built for both models and agents. Like OpenRouter, it exposes a provider/model namespace across many models — but it also combines adaptive routing, automatic failover, zero-markup inference, observability, guardrails, and agent-tool governance behind the same endpoint. Adding orcarouter as a first-class provider means this project's users can use that stack directly, without treating OrcaRouter as an anonymous custom base URL. It also runs gateway-level, zero-trust security for AI agents on the same endpoint — screening every prompt/response and governing every tool call on a default-deny basis, with no application code changes.

Changes

  • unstructured/embed/orcarouter.py — new OrcaRouterEmbeddingConfig + OrcaRouterEmbeddingEncoder. It uses the OpenAI SDK directly against https://api.orcarouter.ai/v1 (same pattern as the existing OctoAI embedder), with a default model of openai/text-embedding-3-small.
  • unstructured/embed/__init__.py — register orcarouter in EMBEDDING_PROVIDER_TO_CLASS_MAP, next to octoai.
  • test_unstructured/embed/test_orcarouter.py — unit tests for embed_documents and embed_query, following the existing test_octoai.py shape.
  • CHANGELOG.md / unstructured/__version__.py — bumped to 0.27.3.

Testing

  • python3 -m pytest test_unstructured/embed/ — 18 passed (including the 2 new tests).
  • ruff check and ruff format --check on all changed files — clean.
  • Live check against the OrcaRouter embeddings endpoint through the new encoder: embed_query returned a 1536-dim vector and embed_documents embedded 2 elements, both via https://api.orcarouter.ai/v1/embeddings.

I'm an engineer on the OrcaRouter team.

Discord: discord.gg/YEubt8enRA · X: https://x.com/OrcaRouter

Review in cubic

Adds an OpenAI-compatible embedding encoder backed by OrcaRouter
(https://www.orcarouter.ai). Like the existing OctoAI embedder it uses the
OpenAI SDK against a custom base URL (https://api.orcarouter.ai/v1) and is
registered in EMBEDDING_PROVIDER_TO_CLASS_MAP as the "orcarouter" provider.

Includes unit tests for embed_documents and embed_query.

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant