Repository navigation
Conversation
emerzon
marked this pull request as ready for review
November 15, 2026 12:34
Contributor
…se calls Dedicated Cohere Parse routing now also covers endpoint.region.inference.ai.azure.com hosts and trailing-dot hostnames, and the passthrough OCR route recognizes the dedicated v2/parse path so those pages are billed like resource endpoint calls.
surlymochan
reviewed
Nov 16, 2026
surlymochan
left a comment
There was a problem hiding this comment.
Reviewed the full diff against #51910. The fix reads correctly to me:
- Dedicated hosts (
*.models.ai.azure.comand<endpoint>.<region>.inference.ai.azure.com) now route to/v2/parse, while resource hosts keep/providers/cohere/v2/parse;passthrough_responseaccepts both paths forAzureCohere. - The Rust tests cover the dedicated forms (root,
/models, gateway prefix,/v2, complete) plus the trailing-dot host, the inference host form, and the negative cases (plainexample.com,resource.inference.ai.azure.com, and the lookalikemodels.ai.azure.com.example.com). - The
AGENTS.mdnote was updated to match the new routing rule.
Two questions (non-blocking, from a reader, not a maintainer):
is_dedicated_hostrequires a dot in the segment before.inference.ai.azure.com, so a bare single-label host such ashttps://parse.inference.ai.azure.comwould fall back to the resource path. Is that host form real, or is the dot requirement intentional?- In the trailing-dot test the expected URL keeps the trailing dot in the host (
{base}/v2/parsewithbaseending in.). Does Azure accept a trailing-dot host, or should the dot be stripped before building the URL?
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Handwritten 1-3 sentence description
Send dedicated Azure Cohere Parse deployments to
/v2/parsewhile keeping the resource endpoint route. Preserve existing path prefixes and query parameters.Details
TLDR
Problem this solves:
How it solves it:
/v2/parsefor*.models.ai.azure.comhosts./v2/parsefor dedicatedinference.ai.azure.comhosts.User Flow
Before, using a dedicated base sends OCR to the wrong route.
POST http://localhost:4000/ocrwith a document./providers/coherein its path.After, the same document uses the dedicated Parse route.
POST http://localhost:4000/ocrwith a document./v2/parseon that host.Relevant issues
Fixes #51910. #39862 introduced Parse support. #39427 is the older closed proposal.
The endpoint distinction follows Cohere's Azure deployment guide and the Parse API reference.
Implementation
The existing Rust URL builder selects the path using the parsed hostname. Dedicated
*.models.ai.azure.comhosts and dedicated<endpoint>.<region>.inference.ai.azure.comhosts use/v2/parse, including trailing-dot hostnames. Other hosts retain/providers/cohere/v2/parse. Prefixes, query parameters, complete Parse URLs and trailing/modelshandling remain covered. The passthrough OCR route now also recognizes the dedicatedv2/parsepath, so those responses normalize and bill the same way as resource endpoint calls. The response format is unchanged.Pre-Submission checklist
Screenshots / Proof of Fix
E2E exception at
83a765544ccba57433909b86b99e4f7b5aa6e080. The dedicated-host regression is reproduced and fixed in the URL builder, and the focused Rust tests below trace the full URL construction for every host form this change touches. Real OCR succeeded through two existing configured development deployments, but that control does not establish a vanilla before-and-after request against a dedicated host. No dedicated endpoint or usable credentials are available in this environment, so the live dedicated-host run remains the one unverified item. No deployment was changed for this test.Before (26807a9)
Apply only the tests from this PR to the base implementation and run the focused Rust command below. The regression run used
00313c9e5b33715e97fbaeaa2a32571be0876536. The production Rust file is byte-identical at the merge base shown above. Four dedicated-base cases fail and four controls pass. For example, the root dedicated host produces this URL.After (83a7655)
Run the same cases with the implementation change.
All 11 cases pass, including dedicated
inference.ai.azure.comhosts, a trailing-dot hostname and a one-label inference resource host keeping the provider path. The passthrough route cases pass too, including the dedicatedv2/parsepath. Formatting passes andmake checkpasses at this tip. The tests fail on the unchanged implementation, so an already complete Parse URL cannot mask the regression.Live OCR control
The following client was run against the existing configured development service using two Parse aliases. Set
QA_PARSE_BASE_URLto a configured proxy,QA_PARSE_API_KEYto its inference key andQA_PARSE_MODELS_JSONto a JSON array of model aliases. The synthetic WEBP fixture contains no user document. Both calls returned HTTP 200 with one page and the fixture text.Exact OCR client, run with python qa_parse_control.py
For the remaining branch-specific live check, build the native bridge from each checkout, point a local proxy at a dedicated
*.models.ai.azure.comdeployment and send the same fixture before and after. Router and coordination Redis must share one dedicated instance, with two serving workers on both legs. That check is pending and is not replaced by the unit tests or development control above.Type
Bug Fix
Caveats
Medium
Low