diff --git a/.golangci.yaml b/.golangci.yaml index 1908165d330..24bf9aab2d5 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -212,3 +212,4 @@ formatters: - third_party$ - builtin$ - examples$ + - api/v1alpha1/ai_policy.go diff --git a/api/v1alpha1/ai_policy.go b/api/v1alpha1/ai_policy.go index 42f5d1a9fee..dbfd4b675cc 100644 --- a/api/v1alpha1/ai_policy.go +++ b/api/v1alpha1/ai_policy.go @@ -17,25 +17,20 @@ import ( // and appends `Describe the painting as if you were a famous art critic from the 17th century.` // to each request that is sent to the `openai` HTTPRoute. // ```yaml -// -// name: openai-opt -// namespace: kgateway-system -// // spec: -// -// targetRefs: -// - group: gateway.networking.k8s.io -// kind: HTTPRoute -// name: openai -// ai: -// promptEnrichment: -// prepend: -// - role: SYSTEM -// content: "Answer all questions in French." -// append: -// - role: USER -// content: "Describe the painting as if you were a famous art critic from the 17th century." -// +// targetRefs: +// - group: gateway.networking.k8s.io +// kind: HTTPRoute +// name: openai +// options: +// ai: +// promptEnrichment: +// prepend: +// - role: SYSTEM +// content: "Answer all questions in French." +// append: +// - role: USER +// content: "Describe the painting as if you were a famous art critic from the 17th century." // ``` type AIPromptEnrichment struct { // A list of messages to be prepended to the prompt sent by the client. @@ -203,21 +198,19 @@ type PromptguardResponse struct { // the string "credit card", and masks any credit card numbers in the response. // ```yaml // promptGuard: -// -// request: -// - response: -// message: "Rejected due to inappropriate content" -// regex: -// action: REJECT -// matches: -// - pattern: "credit card" -// name: "CC" -// response: -// - regex: -// builtins: -// - CREDIT_CARD -// action: MASK -// +// request: +// customResponse: +// message: "Rejected due to inappropriate content" +// regex: +// action: REJECT +// matches: +// - pattern: "credit card" +// name: "CC" +// response: +// regex: +// builtins: +// - CREDIT_CARD +// action: MASK // ``` // +kubebuilder:validation:AtLeastOneOf=request;response type AIPromptGuard struct { @@ -245,7 +238,6 @@ type AIPromptGuard struct { // defaults: // - field: "system" // value: "answer all questions in French" -// // ``` // // Example: Setting a default temperature and overriding `max_tokens`: @@ -264,11 +256,9 @@ type AIPromptGuard struct { // defaults: // - field: "custom_integer_list" // value: [1,2,3] -// // overrides: // - field: "custom_string_list" // value: ["one","two","three"] -// // ``` // // Note: The `field` values correspond to keys in the JSON request body, not fields in this CRD. diff --git a/api/v1alpha1/gateway_parameters_types.go b/api/v1alpha1/gateway_parameters_types.go index 4902a74aa3d..e94e4d57668 100644 --- a/api/v1alpha1/gateway_parameters_types.go +++ b/api/v1alpha1/gateway_parameters_types.go @@ -351,11 +351,11 @@ type EnvoyBootstrap struct { // the values are one of "trace", "debug", "info", "warn", "error", // "critical", or "off", e.g. // - // ```yaml - // componentLogLevels: - // upstream: debug - // connection: trace - // ``` + // ```yaml + // componentLogLevels: + // upstream: debug + // connection: trace + // ``` // // These will be converted to the `--component-log-level` Envoy argument // value. See diff --git a/install/helm/kgateway-crds/templates/gateway.kgateway.dev_agentgatewaybackends.yaml b/install/helm/kgateway-crds/templates/gateway.kgateway.dev_agentgatewaybackends.yaml index 03aeaa7b1b7..cf095005d67 100644 --- a/install/helm/kgateway-crds/templates/gateway.kgateway.dev_agentgatewaybackends.yaml +++ b/install/helm/kgateway-crds/templates/gateway.kgateway.dev_agentgatewaybackends.yaml @@ -248,7 +248,6 @@ spec: defaults: - field: "system" value: "answer all questions in French" - ``` Example: Setting a default temperature and overriding `max_tokens`: @@ -267,11 +266,9 @@ spec: defaults: - field: "custom_integer_list" value: [1,2,3] - overrides: - field: "custom_string_list" value: ["one","two","three"] - ``` Note: The `field` values correspond to keys in the JSON request body, not fields in this CRD. @@ -318,7 +315,6 @@ spec: defaults: - field: "system" value: "answer all questions in French" - ``` Example: Setting a default temperature and overriding `max_tokens`: @@ -337,11 +333,9 @@ spec: defaults: - field: "custom_integer_list" value: [1,2,3] - overrides: - field: "custom_string_list" value: ["one","two","three"] - ``` Note: The `field` values correspond to keys in the JSON request body, not fields in this CRD. @@ -2314,7 +2308,6 @@ spec: defaults: - field: "system" value: "answer all questions in French" - ``` Example: Setting a default temperature and overriding `max_tokens`: @@ -2333,11 +2326,9 @@ spec: defaults: - field: "custom_integer_list" value: [1,2,3] - overrides: - field: "custom_string_list" value: ["one","two","three"] - ``` Note: The `field` values correspond to keys in the JSON request body, not fields in this CRD. @@ -2383,7 +2374,6 @@ spec: defaults: - field: "system" value: "answer all questions in French" - ``` Example: Setting a default temperature and overriding `max_tokens`: @@ -2402,11 +2392,9 @@ spec: defaults: - field: "custom_integer_list" value: [1,2,3] - overrides: - field: "custom_string_list" value: ["one","two","three"] - ``` Note: The `field` values correspond to keys in the JSON request body, not fields in this CRD. diff --git a/install/helm/kgateway-crds/templates/gateway.kgateway.dev_agentgatewaypolicies.yaml b/install/helm/kgateway-crds/templates/gateway.kgateway.dev_agentgatewaypolicies.yaml index 3dffaeded16..62a571de32b 100644 --- a/install/helm/kgateway-crds/templates/gateway.kgateway.dev_agentgatewaypolicies.yaml +++ b/install/helm/kgateway-crds/templates/gateway.kgateway.dev_agentgatewaypolicies.yaml @@ -92,7 +92,6 @@ spec: defaults: - field: "system" value: "answer all questions in French" - ``` Example: Setting a default temperature and overriding `max_tokens`: @@ -111,11 +110,9 @@ spec: defaults: - field: "custom_integer_list" value: [1,2,3] - overrides: - field: "custom_string_list" value: ["one","two","three"] - ``` Note: The `field` values correspond to keys in the JSON request body, not fields in this CRD. @@ -161,7 +158,6 @@ spec: defaults: - field: "system" value: "answer all questions in French" - ``` Example: Setting a default temperature and overriding `max_tokens`: @@ -180,11 +176,9 @@ spec: defaults: - field: "custom_integer_list" value: [1,2,3] - overrides: - field: "custom_string_list" value: ["one","two","three"] - ``` Note: The `field` values correspond to keys in the JSON request body, not fields in this CRD. diff --git a/install/helm/kgateway-crds/templates/gateway.kgateway.dev_gatewayparameters.yaml b/install/helm/kgateway-crds/templates/gateway.kgateway.dev_gatewayparameters.yaml index f4fce29587c..7be2f53f1d7 100644 --- a/install/helm/kgateway-crds/templates/gateway.kgateway.dev_gatewayparameters.yaml +++ b/install/helm/kgateway-crds/templates/gateway.kgateway.dev_gatewayparameters.yaml @@ -665,15 +665,23 @@ spec: componentLogLevels: additionalProperties: type: string - description: "Envoy log levels for specific components. - The keys are component names and\nthe values are one - of \"trace\", \"debug\", \"info\", \"warn\", \"error\",\n\"critical\", - or \"off\", e.g.\n\n\t```yaml\n\tcomponentLogLevels:\n\t - \ upstream: debug\n\t connection: trace\n\t```\n\nThese - will be converted to the `--component-log-level` Envoy - argument\nvalue. See\nhttps://www.envoyproxy.io/docs/envoy/latest/start/quick-start/run-envoy#debugging-envoy\nfor - more information.\n\nNote: the keys and values cannot - be empty, but they are not otherwise validated." + description: |- + Envoy log levels for specific components. The keys are component names and + the values are one of "trace", "debug", "info", "warn", "error", + "critical", or "off", e.g. + + ```yaml + componentLogLevels: + upstream: debug + connection: trace + ``` + + These will be converted to the `--component-log-level` Envoy argument + value. See + https://www.envoyproxy.io/docs/envoy/latest/start/quick-start/run-envoy#debugging-envoy + for more information. + + Note: the keys and values cannot be empty, but they are not otherwise validated. type: object logLevel: description: |-