Skip to content

Commit

Permalink
Sync Gloo APIs. Destination Branch: gloo-main
Browse files Browse the repository at this point in the history
  • Loading branch information
soloio-bot committed Oct 11, 2024
1 parent 9ee2b9d commit 3389aea
Show file tree
Hide file tree
Showing 10 changed files with 2,256 additions and 716 deletions.
24 changes: 24 additions & 0 deletions api/gloo/gloo/external/envoy/config/trace/v3/datadog.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ syntax = "proto3";
package solo.io.envoy.config.trace.v3;

import "google/protobuf/wrappers.proto";
import "google/protobuf/duration.proto";

import "udpa/annotations/migrate.proto";
import "udpa/annotations/status.proto";
Expand All @@ -19,6 +20,18 @@ option (solo.io.udpa.annotations.file_status).package_version_status = ACTIVE;

// [#protodoc-title: Datadog tracer]

// Configuration for the Remote Configuration feature.
message DatadogRemoteConfig {
// Frequency at which new configuration updates are queried.
// If no value is provided, the default value is delegated to the Datadog tracing library.
google.protobuf.Duration polling_interval = 1;

// Disabled remote config.
// This field does not exist in envoy's config but allow us to preserve the default behavior
// when upgrading to envoy v1.31
google.protobuf.BoolValue disabled = 2;
}

// Configuration for the Datadog tracer.
// [#extension: envoy.tracers.datadog]
message DatadogConfig {
Expand All @@ -38,6 +51,17 @@ message DatadogConfig {

// The name used for the service when traces are generated by envoy.
google.protobuf.StringValue service_name = 2 [(validate.rules).string = {min_len: 1}];

// Optional hostname to use when sending spans to the collector_cluster. Useful for collectors
// that require a specific hostname. Defaults to :ref:`collector_cluster <envoy_v3_api_field_config.trace.v3.DatadogConfig.collector_cluster>` above.
string collector_hostname = 4;

// Configures remote configuration.
// Remote Configuration allows to configure the tracer from Datadog's user interface.
// This feature can drastically increase the number of connections to the Datadog Agent.
// Each tracer regularly polls for configuration updates, and the number of tracers is the product
// of the number of listeners and worker threads.
DatadogRemoteConfig remote_config = 5;
}
option go_package = "github.com/solo-io/solo-apis/pkg/api/gloo.solo.io/external/envoy/config/trace/v3";
import "extproto/ext.proto";
Expand Down
156 changes: 120 additions & 36 deletions api/gloo/gloo/v1/enterprise/options/ai/ai.proto
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ message SingleAuthToken {
*/
message UpstreamSpec {

// Settings to configure a custom host to send the traffic to
message CustomHost {
// Custom host to send the traffic to
string host = 1;
Expand Down Expand Up @@ -125,6 +126,25 @@ message UpstreamSpec {
string api_version = 4;
}

// Settings for the Gemini API
message Gemini {
// Auth Token to use for the Gemini API
// This token will be placed into the `key` header
oneof auth_token_source {
// Auth Token to use for the Gemini API
// This token will be placed into the `key` header
SingleAuthToken auth_token = 1;
// TODO: use oauth
}

// The model name to use
// This value can be found https://generativelanguage.googleapis.com/{version}/models/{model}:generateContent?key={api_key}
string model = 2;
// The version of the API to use
// This value can be found https://generativelanguage.googleapis.com/{api_version}/models/{model}:generateContent?key={api_key}
string api_version = 3;
}

// Settings for the Mistral API
message Mistral {
// Auth Token to use for the Mistral API.
Expand All @@ -139,6 +159,7 @@ message UpstreamSpec {
string model = 3;
}

// Settings for the Anthropic API
message Anthropic {
// Auth Token to use for the Anthropic API.
// This token will be placed into the `x-api-key` header
Expand Down Expand Up @@ -201,10 +222,14 @@ message UpstreamSpec {
Anthropic anthropic = 3;
// Azure OpenAI upstream
AzureOpenAI azure_openai = 4;
// Gemini upstream
Gemini gemini = 5;
}
}

// Priority represents a single endpoint pool with a given priority
message Priority {
// list of backends representing a single endpoint pool
repeated Backend pool = 1;
}

Expand All @@ -224,6 +249,8 @@ message UpstreamSpec {
AzureOpenAI azure_openai = 4;
// multi upstream
MultiPool multi = 5;
// Gemini upstream
Gemini gemini = 6;
}
}

Expand Down Expand Up @@ -277,15 +304,17 @@ message RouteSettings {
promptGuard:
request:
customResponseMessage: "Rejected due to inappropriate content"
matches:
- "credit card"
regex:
matches:
- "credit card"
response:
matches:
# Mastercard
- '(?:^|\D)(5[1-5][0-9]{2}(?:\ |\-|)[0-9]{4}(?:\ |\-|)[0-9]{4}(?:\ |\-|)[0-9]{4})(?:\D|$)'
regex:
matches:
# Mastercard
- '(?:^|\D)(5[1-5][0-9]{2}(?:\ |\-|)[0-9]{4}(?:\ |\-|)[0-9]{4}(?:\ |\-|)[0-9]{4})(?:\D|$)'
````
*/
AIPromptGaurd prompt_guard = 2;
AIPromptGuard prompt_guard = 2;

/*
Retrieval Augmented Generation. https://research.ibm.com/blog/retrieval-augmented-generation-RAG
Expand All @@ -311,6 +340,7 @@ message RouteSettings {
```
*/
RAG rag = 3;

/*
Semantic caching configuration
Semantic caching allows you to cache previous model responses in order to provide
Expand Down Expand Up @@ -386,6 +416,8 @@ message Postgres {


message Embedding {

// OpenAI embedding
message OpenAI {
oneof auth_token_source {
SingleAuthToken auth_token = 1;
Expand All @@ -394,6 +426,7 @@ message Embedding {
}
}

// Azure OpenAI embedding
message AzureOpenAI {
oneof auth_token_source {
// Auth Token to use for the OpenAI API
Expand Down Expand Up @@ -424,7 +457,10 @@ message Embedding {
}
}

// Settings for the Semantic Caching feature
message SemanticCache {

// Settings for the Redis database
message Redis {
// Connection string to the Redis database
string connection_string = 1;
Expand All @@ -438,6 +474,7 @@ message SemanticCache {
float score_threshold = 2;
}

// Settings for the Weaviate database
message Weaviate {
// Connection string to the Weaviate database, scheme should NOT be included.
// For example: weaviate.my-ns.svc.cluster.local
Expand All @@ -450,6 +487,7 @@ message SemanticCache {
// Whether or not to use a secure connection, true by default
bool insecure = 4;
}

// Data store from which to cache the request/response pairs
message DataStore {
oneof datastore {
Expand All @@ -473,6 +511,7 @@ message SemanticCache {
Mode mode = 4;
}

// Settings for the Retrieval Augmented Generation feature
message RAG {
message DataStore {
oneof datastore {
Expand All @@ -487,11 +526,7 @@ message RAG {
string prompt_template = 3;
}

message RateLimiting {
// List of rate_limit configs to apply
repeated string rate_limit_configs = 1;
}

// Settings for the Prompt Enrichment feature
message AIPromptEnrichment {
message Message {
// Role of the message.
Expand All @@ -508,39 +543,88 @@ message AIPromptEnrichment {

}

message AIPromptGaurd {
message Request {
// A list of Regex patterns to match against the prompt.
// Each one will be checked against the prompt and if any match
// the request will be rejected.
// Settings for the Prompt Guard feature
message AIPromptGuard {

// Regex settings for prompt guard
message Regex {
enum BuiltIn {
// Default REGEX for Social Security Numbers
SSN = 0;
// Default REGEX for Credit Card Numbers
CREDIT_CARD = 1;
}
// A list of Regex patterns to match against the response.
// All matches will be masked before being sent back to the client.
// matches and builtins are additive.
repeated string matches = 1;
// A list of built-in regexes to mask in the response.
// matches and builtins are additive.
repeated BuiltIn builtins = 2;
}

// Webhook settings for prompt guard
message Webhook {
// Host to send the traffic to.
string host = 1;
// Port to send the traffic to
uint32 port = 2;
message HeaderMatch {
enum MatchType {
// Exact match
EXACT = 0;
// Prefix match
PREFIX = 1;
// Suffix match
SUFFIX = 2;
// Contains match
CONTAINS = 3;
// Regex match
REGEX = 4;
}
// Header key to match
string key = 1;
// Type of match to use
MatchType match_type = 2;
}
// Headers to forward with the request
repeated HeaderMatch headers = 3;
}


// Request settings for Prompt Guard
message Request {
message CustomResponse {
// Custom response message to send back to the client.
// If not specified, the following default message will be used:
// "The request was rejected due to inappropriate content"
string message = 1;

// Status code to send back to the client.
uint32 status_code = 2;
}
// Custom response message to send back to the client.
// If not specified, the following default message will be used:
// "The request was rejected due to inappropriate content"
string custom_response_message = 2;
CustomResponse custom_response = 1;

// Regex request guard
Regex regex = 2;

// Webhook request guard
Webhook webhook = 3;
}

// Request settings for Prompt Guard
message Response {
enum BuiltIn {
// Default REGEX for Social Security Numbers
SSN = 0;
// Default REGEX for Credit Card Numbers
CREDIT_CARD = 1;
// Default REGEX for Email Addresses
EMAIL = 2;
// Default REGEX for Phone Numbers
PHONE_NUMBER = 3;
}
// A list of Regex patterns to match against the response.
// All matches will be masked before being sent back to the client.
// matches and builtins are additive.
repeated string matches = 1;
// A list of built-in regexes to mask in the response.
// matches and builtins are additive.
repeated BuiltIn builtins = 2;
// Regex response guard
Regex regex = 1;

// Webhook response guard
Webhook webhook = 2;
}
// Guards for the prompt request
Request request = 2;
Request request = 1;
// Guards for the LLM response
Response response = 3;
Response response = 2;
}

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

Loading

0 comments on commit 3389aea

Please sign in to comment.