Skip to content

Commit

Permalink
less conflict with #100
Browse files Browse the repository at this point in the history
Signed-off-by: Takeshi Yoneda <[email protected]>
  • Loading branch information
mathetake committed Jan 16, 2025
1 parent 77516d4 commit dba4b9f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions api/v1alpha1/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ type AIGatewayRouteSpec struct {
//
// +kubebuilder:validation:Required
// +kubebuilder:validation:XValidation:rule="self.schema == 'OpenAI'"
APISchema VersionedAPISchema `json:"inputSchema"`
APISchema LLMAPISchema `json:"inputSchema"`
// Rules is the list of AIGatewayRouteRule that this AIGatewayRoute will match the traffic to.
// Each rule is a subset of the HTTPRoute in the Gateway API (https://gateway-api.sigs.k8s.io/api-types/httproute/).
//
Expand Down Expand Up @@ -215,7 +215,7 @@ type AIServiceBackendSpec struct {
// This is required to be set.
//
// +kubebuilder:validation:Required
APISchema VersionedAPISchema `json:"outputSchema"`
APISchema LLMAPISchema `json:"outputSchema"`
// BackendRef is the reference to the Backend resource that this AIServiceBackend corresponds to.
//
// A backend can be of either k8s Service or Backend resource of Envoy Gateway.
Expand All @@ -232,14 +232,14 @@ type AIServiceBackendSpec struct {
BackendSecurityPolicyRef *gwapiv1.LocalObjectReference `json:"backendSecurityPolicyRef,omitempty"`
}

// VersionedAPISchema defines the API schema of either AIGatewayRoute (the input) or AIServiceBackend (the output).
// LLMAPISchema defines the API schema of either AIGatewayRoute (the input) or AIServiceBackend (the output).
//
// This allows the ai-gateway to understand the input and perform the necessary transformation
// depending on the API schema pair (input, output).
//
// Note that this is vendor specific, and the stability of the API schema is not guaranteed by
// the ai-gateway, but by the vendor via proper versioning.
type VersionedAPISchema struct {
type LLMAPISchema struct {
// Schema is the API schema of the AIGatewayRoute or AIServiceBackend.
//
// +kubebuilder:validation:Enum=OpenAI;AWSBedrock
Expand Down
8 changes: 4 additions & 4 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions internal/controller/sink_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func TestConfigSink_syncLLMRoute(t *testing.T) {
BackendRefs: []aigv1a1.AIGatewayRouteRuleBackendRef{{Name: "apple", Weight: 1}, {Name: "orange", Weight: 1}},
},
},
APISchema: aigv1a1.VersionedAPISchema{Schema: aigv1a1.APISchemaOpenAI, Version: "v123"},
APISchema: aigv1a1.LLMAPISchema{Schema: aigv1a1.APISchemaOpenAI, Version: "v123"},
},
}
err := fakeClient.Create(context.Background(), route, &client.CreateOptions{})
Expand Down Expand Up @@ -215,7 +215,7 @@ func Test_updateExtProcConfigMap(t *testing.T) {
{
ObjectMeta: metav1.ObjectMeta{Name: "apple", Namespace: "ns"},
Spec: aigv1a1.AIServiceBackendSpec{
APISchema: aigv1a1.VersionedAPISchema{
APISchema: aigv1a1.LLMAPISchema{
Schema: aigv1a1.APISchemaAWSBedrock,
},
BackendRef: egv1a1.BackendRef{
Expand Down Expand Up @@ -255,7 +255,7 @@ func Test_updateExtProcConfigMap(t *testing.T) {
route: &aigv1a1.AIGatewayRoute{
ObjectMeta: metav1.ObjectMeta{Name: "myroute", Namespace: "ns"},
Spec: aigv1a1.AIGatewayRouteSpec{
APISchema: aigv1a1.VersionedAPISchema{Schema: aigv1a1.APISchemaOpenAI, Version: "v123"},
APISchema: aigv1a1.LLMAPISchema{Schema: aigv1a1.APISchemaOpenAI, Version: "v123"},
Rules: []aigv1a1.AIGatewayRouteRule{
{
BackendRefs: []aigv1a1.AIGatewayRouteRuleBackendRef{
Expand Down
2 changes: 1 addition & 1 deletion tests/controller/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
"github.com/envoyproxy/ai-gateway/tests"
)

var defaultSchema = aigv1a1.VersionedAPISchema{Schema: aigv1a1.APISchemaOpenAI, Version: "v1"}
var defaultSchema = aigv1a1.LLMAPISchema{Schema: aigv1a1.APISchemaOpenAI, Version: "v1"}

func extProcName(aiGatewayRouteName string) string {
return fmt.Sprintf("ai-gateway-ai-gateway-route-extproc-%s", aiGatewayRouteName)
Expand Down

0 comments on commit dba4b9f

Please sign in to comment.