feat(#286): Add Smart Router infrastructure for multiple providers#438
feat(#286): Add Smart Router infrastructure for multiple providers#438beitiataidy-ops wants to merge 9 commits intoarakoodev:tsfrom
Conversation
| CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fc0ed0c0e1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| | "claude-3-haiku-20240307"; | ||
| | ||
| export type role = "user" | "assistant" | "system"; | ||
| export type Provider = "openai" | "google" | "cohere" | "anthropic" | "mistral"; |
There was a problem hiding this comment.
Restore exported role type for existing providers
This update drops the role export from types/index.ts, but existing modules still import it (lib/openai/openai.ts:4 and lib/llama/llama.ts:2), so type-checked builds will fail with a missing export error (TS2305). That makes this a breaking regression introduced by the new type changes, even before SmartRouter is used.
Useful? React with 👍 / 👎.
| throw new Error("No endpoints configured in SmartRouter"); | ||
| } | ||
| | ||
| if (options.strategy === "priority" || options.strategy === "failover") { |
There was a problem hiding this comment.
Handle latency strategy in SmartRouter.chat
SmartRouterOptions includes strategy: "latency", but chat() only enters the endpoint execution loop for priority and failover; when callers pass latency, it always jumps to throw new Error("All endpoints failed...") even with valid endpoints configured. This makes the advertised latency mode unusable and causes deterministic runtime failures.
Useful? React with 👍 / 👎.
| I have read the Arakoo CLA Document and I hereby sign the CLA |
This PR adds a unified Smart Router to EdgeChains, supporting multiple providers like OpenAI, Gemini, Cohere, Anthropic, and Mistral as requested in #286.
Current status: