Skip to content

Commit

Permalink
[1.18] AI backport of (#10494) and (#10640) (#10649)
Browse files Browse the repository at this point in the history
Co-authored-by: Eitan Yarmush <[email protected]>
Co-authored-by: David Jumani <[email protected]>
  • Loading branch information
3 people authored Feb 25, 2025
1 parent 5d4dac8 commit 5962f10
Show file tree
Hide file tree
Showing 13 changed files with 590 additions and 421 deletions.
9 changes: 9 additions & 0 deletions changelog/v1.18.10/ai-semantic-caching-distance.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
changelog:
- type: FIX
issueLink: https://github.com/solo-io/solo-projects/issues/7440
resolvesIssue: false
description: >
Fixes an issue where the ai semantic caching distance is not being set correctly in the cache. Also
move the distance threshold to the cache configuration, rather than per datastore.
6 changes: 6 additions & 0 deletions changelog/v1.18.10/ai-upstream-custom-hostname.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
changelog:
- type: FIX
issueLink: https://github.com/solo-io/solo-projects/issues/7831
resolvesIssue: false
description: >
Added optional `hostname` to the AI Upstream CustomHost setting to override SNI and host header value

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

2 changes: 2 additions & 0 deletions install/helm/gloo/crds/gateway.solo.io_v1_RouteOption.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,8 @@ spec:
type: boolean
type: object
type: object
distanceThreshold:
type: number
embedding:
properties:
azureOpenai:
Expand Down
2 changes: 2 additions & 0 deletions install/helm/gloo/crds/gateway.solo.io_v1_RouteTable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,8 @@ spec:
type: boolean
type: object
type: object
distanceThreshold:
type: number
embedding:
properties:
azureOpenai:
Expand Down
2 changes: 2 additions & 0 deletions install/helm/gloo/crds/gateway.solo.io_v1_VirtualService.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3492,6 +3492,8 @@ spec:
type: boolean
type: object
type: object
distanceThreshold:
type: number
embedding:
properties:
azureOpenai:
Expand Down
18 changes: 18 additions & 0 deletions install/helm/gloo/crds/gloo.solo.io_v1_Upstream.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ spec:
properties:
host:
type: string
hostname:
nullable: true
type: string
port:
maximum: 4294967295
minimum: 0
Expand Down Expand Up @@ -121,6 +124,9 @@ spec:
properties:
host:
type: string
hostname:
nullable: true
type: string
port:
maximum: 4294967295
minimum: 0
Expand Down Expand Up @@ -157,6 +163,9 @@ spec:
properties:
host:
type: string
hostname:
nullable: true
type: string
port:
maximum: 4294967295
minimum: 0
Expand Down Expand Up @@ -231,6 +240,9 @@ spec:
properties:
host:
type: string
hostname:
nullable: true
type: string
port:
maximum: 4294967295
minimum: 0
Expand Down Expand Up @@ -259,6 +271,9 @@ spec:
properties:
host:
type: string
hostname:
nullable: true
type: string
port:
maximum: 4294967295
minimum: 0
Expand Down Expand Up @@ -322,6 +337,9 @@ spec:
properties:
host:
type: string
hostname:
nullable: true
type: string
port:
maximum: 4294967295
minimum: 0
Expand Down
15 changes: 14 additions & 1 deletion projects/gloo/api/v1/enterprise/options/ai/ai.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ option go_package = "github.com/solo-io/gloo/projects/gloo/pkg/api/v1/enterprise

import "github.com/solo-io/solo-kit/api/v1/ref.proto";
import "google/protobuf/struct.proto";
import "google/protobuf/wrappers.proto";
import "extproto/ext.proto";
option (extproto.equal_all) = true;
option (extproto.hash_all) = true;
Expand Down Expand Up @@ -60,10 +61,13 @@ message UpstreamSpec {
// Send requests to a custom host and port, such as to proxy the request,
// or to use a different backend that is API-compliant with the upstream version.
message CustomHost {
// Custom host to send the traffic requests to.
// Custom host or IP address to send the traffic requests to.
string host = 1;
// Custom port to send the traffic requests to.
uint32 port = 2;
// Optional: hostname used to set the SNI (if is secure connection) and the host request header.
// If hostname is not set, host will be used instead
google.protobuf.StringValue hostname = 3;
}

// Settings for the [OpenAI](https://platform.openai.com/docs/overview) LLM provider.
Expand Down Expand Up @@ -431,6 +435,7 @@ message SemanticCache {
//
// +kubebuilder:validation:Minimum=0
// +kubebuilder:validation:Maximum=1
// Deprecated: Prefer setting the distance threshold in the RouteOptions.SemanticCache resource.
float score_threshold = 2;
}

Expand Down Expand Up @@ -474,6 +479,14 @@ message SemanticCache {
uint32 ttl = 3;
// The caching mode to use for the request and response lifecycle. Supported values include `READ_WRITE` or `READ_ONLY`.
Mode mode = 4;

// Distance score threshold value between 0.0 and 1.0 that determines how similar
// two queries must be in order to return a cached result.
// The lower the number, the more similar the queries must be for a cache hit.
//
// +kubebuilder:validation:Minimum=0
// +kubebuilder:validation:Maximum=1
float distance_threshold = 5;
}

// [Retrieval augmented generation (RAG)](https://research.ibm.com/blog/retrieval-augmented-generation-RAG)
Expand Down
10 changes: 10 additions & 0 deletions projects/gloo/pkg/api/v1/enterprise/options/ai/ai.pb.clone.go

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

14 changes: 14 additions & 0 deletions projects/gloo/pkg/api/v1/enterprise/options/ai/ai.pb.equal.go

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

Loading

0 comments on commit 5962f10

Please sign in to comment.