-
Notifications
You must be signed in to change notification settings - Fork 6
Add apiTypes and routingGroups
#112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
gateway/src/types.ts
Outdated
| /** @apiTypes: the APIs that the provider supports. Example: ['chat', 'responses'] */ | ||
| apiTypes: APIType[] | ||
| /** @routingGroups: a grouping of APIs that serve the same models. | ||
| * @example: ['anthropic'] would route the requests to Anthropic, Bedrock and Vertex AI. */ | ||
| routingGroups?: string[] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this fine on the PAIG side, or not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'll make the production code more complicated, but only a little bit.
Why not change it here to just routingGroup?: string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is also a logic that needs attention!
|
I need to add a test using I find it a bit weird that when calling chat completions, we need to set |
samuelcolvin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
otherwise LGTM.
gateway/src/types.ts
Outdated
| /** @apiTypes: the APIs that the provider supports. Example: ['chat', 'responses'] */ | ||
| apiTypes: APIType[] | ||
| /** @routingGroups: a grouping of APIs that serve the same models. | ||
| * @example: ['anthropic'] would route the requests to Anthropic, Bedrock and Vertex AI. */ | ||
| routingGroups?: string[] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'll make the production code more complicated, but only a little bit.
Why not change it here to just routingGroup?: string?
| let providerProxies = apiKeyInfo.providers.filter((p) => p.providerId === provider) | ||
| let providerProxies = apiKeyInfo.providers.filter((p) => p.apiTypes.includes(apiType)) | ||
|
|
||
| const routingGroup = request.headers.get('pydantic-ai-gateway-routing-group') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a reason we can't use a query parameter here? I that would be easier to debug.
Also, I think paig-routing is a better name maybe?
No description provided.