diff --git a/adapter/internal/controlplane/eventPublisher.go b/adapter/internal/controlplane/eventPublisher.go index 3cad85379..9aa28a3a6 100644 --- a/adapter/internal/controlplane/eventPublisher.go +++ b/adapter/internal/controlplane/eventPublisher.go @@ -82,6 +82,7 @@ type API struct { IsDefaultVersion bool `json:"isDefaultVersion"` Definition string `json:"definition"` APIType string `json:"apiType"` + APISubType string `json:"apiSubType"` BasePath string `json:"basePath"` Organization string `json:"organization"` SystemAPI bool `json:"systemAPI"` @@ -98,18 +99,25 @@ type API struct { AuthHeader string `json:"authHeader"` APIKeyHeader string `json:"apiKeyHeader"` Operations []Operation `json:"operations"` + AIConfiguration AIConfiguration `json:"aiConfiguration"` APIHash string `json:"-"` - SandAIRL *AIRL `json:"sandAIRL"` - ProdAIRL *AIRL `json:"prodAIRL"` + SandAIRL *AIRL `json:"sandAIRL"` + ProdAIRL *AIRL `json:"prodAIRL"` } // AIRL holds AI ratelimit related data type AIRL struct { - PromptTokenCount *uint32 `json:"promptTokenCount"` - CompletionTokenCount *uint32 `json:"CompletionTokenCount"` - TotalTokenCount *uint32 `json:"totalTokenCount"` - TimeUnit string `json:"timeUnit"` - RequestCount *uint32 `json:"requestCount"` + PromptTokenCount *uint32 `json:"promptTokenCount"` + CompletionTokenCount *uint32 `json:"CompletionTokenCount"` + TotalTokenCount *uint32 `json:"totalTokenCount"` + TimeUnit string `json:"timeUnit"` + RequestCount *uint32 `json:"requestCount"` +} + +// AIConfiguration holds the AI configuration +type AIConfiguration struct { + LLMProviderName string `json:"llmProviderName"` + LLMProviderAPIVersion string `json:"llmProviderAPIVersion"` } // Headers contains the request and response header modifier information diff --git a/adapter/internal/operator/controllers/dp/api_controller.go b/adapter/internal/operator/controllers/dp/api_controller.go index eb3af1d67..eeadc758e 100644 --- a/adapter/internal/operator/controllers/dp/api_controller.go +++ b/adapter/internal/operator/controllers/dp/api_controller.go @@ -2923,11 +2923,24 @@ func (apiReconciler *APIReconciler) convertAPIStateToAPICp(ctx context.Context, RequestCount: requestC, } } + subType := "DEFAULT" + aiConfiguration := controlplane.AIConfiguration{} + if apiState.AIProvider != nil { + loggers.LoggerAPKOperator.Debugf("AIProvider is found") + subType = "AIAPI" + aiConfiguration = controlplane.AIConfiguration{ + LLMProviderName: apiState.AIProvider.Spec.ProviderName, + LLMProviderAPIVersion: apiState.AIProvider.Spec.ProviderAPIVersion, + } + } + loggers.LoggerAPKOperator.Debugf("Resolved aiConfiguration: %+v", aiConfiguration) + api := controlplane.API{ APIName: spec.APIName, APIVersion: spec.APIVersion, IsDefaultVersion: spec.IsDefaultVersion, APIType: spec.APIType, + APISubType: subType, BasePath: spec.BasePath, Organization: spec.Organization, Environment: spec.Environment, @@ -2949,6 +2962,7 @@ func (apiReconciler *APIReconciler) convertAPIStateToAPICp(ctx context.Context, APIKeyHeader: apiKeyHeader, SandAIRL: &sandAIRLToAgent, ProdAIRL: &prodAIRLToAgent, + AIConfiguration: aiConfiguration, } apiCPEvent.API = api apiCPEvent.CRName = apiState.APIDefinition.ObjectMeta.Name