ai

package
v1.18.0-beta10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 22, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AIPromptGaurd_Response_BuiltIn_name = map[int32]string{
		0: "SSN",
		1: "CREDIT_CARD",
		2: "EMAIL",
		3: "PHONE_NUMBER",
	}
	AIPromptGaurd_Response_BuiltIn_value = map[string]int32{
		"SSN":          0,
		"CREDIT_CARD":  1,
		"EMAIL":        2,
		"PHONE_NUMBER": 3,
	}
)

Enum value maps for AIPromptGaurd_Response_BuiltIn.

View Source
var File_github_com_solo_io_gloo_projects_gloo_api_v1_enterprise_options_ai_ai_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type AIPromptEnrichment

type AIPromptEnrichment struct {

	// A list of messages to be prepended to the prompt sent by the client
	Prepend []*AIPromptEnrichment_Message `protobuf:"bytes,2,rep,name=prepend,proto3" json:"prepend,omitempty"`
	// A list of messages to be appended to the prompt sent by the client
	Append []*AIPromptEnrichment_Message `protobuf:"bytes,3,rep,name=append,proto3" json:"append,omitempty"`
	// contains filtered or unexported fields
}

func (*AIPromptEnrichment) Clone

func (m *AIPromptEnrichment) Clone() proto.Message

Clone function

func (*AIPromptEnrichment) Descriptor deprecated

func (*AIPromptEnrichment) Descriptor() ([]byte, []int)

Deprecated: Use AIPromptEnrichment.ProtoReflect.Descriptor instead.

func (*AIPromptEnrichment) Equal

func (m *AIPromptEnrichment) Equal(that interface{}) bool

Equal function

func (*AIPromptEnrichment) GetAppend

func (*AIPromptEnrichment) GetPrepend

func (*AIPromptEnrichment) Hash

func (m *AIPromptEnrichment) Hash(hasher hash.Hash64) (uint64, error)

Hash function

func (*AIPromptEnrichment) ProtoMessage

func (*AIPromptEnrichment) ProtoMessage()

func (*AIPromptEnrichment) ProtoReflect

func (x *AIPromptEnrichment) ProtoReflect() protoreflect.Message

func (*AIPromptEnrichment) Reset

func (x *AIPromptEnrichment) Reset()

func (*AIPromptEnrichment) String

func (x *AIPromptEnrichment) String() string

type AIPromptEnrichment_Message

type AIPromptEnrichment_Message struct {

	// Role of the message.
	// The available roles depend on the backend model being used,
	// please consult the documentation for more information.
	Role string `protobuf:"bytes,1,opt,name=role,proto3" json:"role,omitempty"`
	// String content of the message
	Content string `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"`
	// contains filtered or unexported fields
}

func (*AIPromptEnrichment_Message) Clone

Clone function

func (*AIPromptEnrichment_Message) Descriptor deprecated

func (*AIPromptEnrichment_Message) Descriptor() ([]byte, []int)

Deprecated: Use AIPromptEnrichment_Message.ProtoReflect.Descriptor instead.

func (*AIPromptEnrichment_Message) Equal

func (m *AIPromptEnrichment_Message) Equal(that interface{}) bool

Equal function

func (*AIPromptEnrichment_Message) GetContent

func (x *AIPromptEnrichment_Message) GetContent() string

func (*AIPromptEnrichment_Message) GetRole

func (x *AIPromptEnrichment_Message) GetRole() string

func (*AIPromptEnrichment_Message) Hash

func (m *AIPromptEnrichment_Message) Hash(hasher hash.Hash64) (uint64, error)

Hash function

func (*AIPromptEnrichment_Message) ProtoMessage

func (*AIPromptEnrichment_Message) ProtoMessage()

func (*AIPromptEnrichment_Message) ProtoReflect

func (*AIPromptEnrichment_Message) Reset

func (x *AIPromptEnrichment_Message) Reset()

func (*AIPromptEnrichment_Message) String

func (x *AIPromptEnrichment_Message) String() string

type AIPromptGaurd

type AIPromptGaurd struct {

	// Guards for the prompt request
	Request *AIPromptGaurd_Request `protobuf:"bytes,2,opt,name=request,proto3" json:"request,omitempty"`
	// Guards for the LLM response
	Response *AIPromptGaurd_Response `protobuf:"bytes,3,opt,name=response,proto3" json:"response,omitempty"`
	// contains filtered or unexported fields
}

func (*AIPromptGaurd) Clone

func (m *AIPromptGaurd) Clone() proto.Message

Clone function

func (*AIPromptGaurd) Descriptor deprecated

func (*AIPromptGaurd) Descriptor() ([]byte, []int)

Deprecated: Use AIPromptGaurd.ProtoReflect.Descriptor instead.

func (*AIPromptGaurd) Equal

func (m *AIPromptGaurd) Equal(that interface{}) bool

Equal function

func (*AIPromptGaurd) GetRequest

func (x *AIPromptGaurd) GetRequest() *AIPromptGaurd_Request

func (*AIPromptGaurd) GetResponse

func (x *AIPromptGaurd) GetResponse() *AIPromptGaurd_Response

func (*AIPromptGaurd) Hash

func (m *AIPromptGaurd) Hash(hasher hash.Hash64) (uint64, error)

Hash function

func (*AIPromptGaurd) ProtoMessage

func (*AIPromptGaurd) ProtoMessage()

func (*AIPromptGaurd) ProtoReflect

func (x *AIPromptGaurd) ProtoReflect() protoreflect.Message

func (*AIPromptGaurd) Reset

func (x *AIPromptGaurd) Reset()

func (*AIPromptGaurd) String

func (x *AIPromptGaurd) String() string

type AIPromptGaurd_Request

type AIPromptGaurd_Request struct {

	// 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.
	Matches []string `protobuf:"bytes,1,rep,name=matches,proto3" json:"matches,omitempty"`
	// 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"
	CustomResponseMessage string `` /* 126-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*AIPromptGaurd_Request) Clone

func (m *AIPromptGaurd_Request) Clone() proto.Message

Clone function

func (*AIPromptGaurd_Request) Descriptor deprecated

func (*AIPromptGaurd_Request) Descriptor() ([]byte, []int)

Deprecated: Use AIPromptGaurd_Request.ProtoReflect.Descriptor instead.

func (*AIPromptGaurd_Request) Equal

func (m *AIPromptGaurd_Request) Equal(that interface{}) bool

Equal function

func (*AIPromptGaurd_Request) GetCustomResponseMessage

func (x *AIPromptGaurd_Request) GetCustomResponseMessage() string

func (*AIPromptGaurd_Request) GetMatches

func (x *AIPromptGaurd_Request) GetMatches() []string

func (*AIPromptGaurd_Request) Hash

func (m *AIPromptGaurd_Request) Hash(hasher hash.Hash64) (uint64, error)

Hash function

func (*AIPromptGaurd_Request) ProtoMessage

func (*AIPromptGaurd_Request) ProtoMessage()

func (*AIPromptGaurd_Request) ProtoReflect

func (x *AIPromptGaurd_Request) ProtoReflect() protoreflect.Message

func (*AIPromptGaurd_Request) Reset

func (x *AIPromptGaurd_Request) Reset()

func (*AIPromptGaurd_Request) String

func (x *AIPromptGaurd_Request) String() string

type AIPromptGaurd_Response

type AIPromptGaurd_Response struct {

	// 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.
	Matches []string `protobuf:"bytes,1,rep,name=matches,proto3" json:"matches,omitempty"`
	// A list of built-in regexes to mask in the response.
	// matches and builtins are additive.
	Builtins []AIPromptGaurd_Response_BuiltIn `` /* 137-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*AIPromptGaurd_Response) Clone

Clone function

func (*AIPromptGaurd_Response) Descriptor deprecated

func (*AIPromptGaurd_Response) Descriptor() ([]byte, []int)

Deprecated: Use AIPromptGaurd_Response.ProtoReflect.Descriptor instead.

func (*AIPromptGaurd_Response) Equal

func (m *AIPromptGaurd_Response) Equal(that interface{}) bool

Equal function

func (*AIPromptGaurd_Response) GetBuiltins

func (*AIPromptGaurd_Response) GetMatches

func (x *AIPromptGaurd_Response) GetMatches() []string

func (*AIPromptGaurd_Response) Hash

func (m *AIPromptGaurd_Response) Hash(hasher hash.Hash64) (uint64, error)

Hash function

func (*AIPromptGaurd_Response) ProtoMessage

func (*AIPromptGaurd_Response) ProtoMessage()

func (*AIPromptGaurd_Response) ProtoReflect

func (x *AIPromptGaurd_Response) ProtoReflect() protoreflect.Message

func (*AIPromptGaurd_Response) Reset

func (x *AIPromptGaurd_Response) Reset()

func (*AIPromptGaurd_Response) String

func (x *AIPromptGaurd_Response) String() string

type AIPromptGaurd_Response_BuiltIn

type AIPromptGaurd_Response_BuiltIn int32
const (
	// Default REGEX for Social Security Numbers
	AIPromptGaurd_Response_SSN AIPromptGaurd_Response_BuiltIn = 0
	// Default REGEX for Credit Card Numbers
	AIPromptGaurd_Response_CREDIT_CARD AIPromptGaurd_Response_BuiltIn = 1
	// Default REGEX for Email Addresses
	AIPromptGaurd_Response_EMAIL AIPromptGaurd_Response_BuiltIn = 2
	// Default REGEX for Phone Numbers
	AIPromptGaurd_Response_PHONE_NUMBER AIPromptGaurd_Response_BuiltIn = 3
)

func (AIPromptGaurd_Response_BuiltIn) Descriptor

func (AIPromptGaurd_Response_BuiltIn) Enum

func (AIPromptGaurd_Response_BuiltIn) EnumDescriptor deprecated

func (AIPromptGaurd_Response_BuiltIn) EnumDescriptor() ([]byte, []int)

Deprecated: Use AIPromptGaurd_Response_BuiltIn.Descriptor instead.

func (AIPromptGaurd_Response_BuiltIn) Number

func (AIPromptGaurd_Response_BuiltIn) String

func (AIPromptGaurd_Response_BuiltIn) Type

type Embedding

type Embedding struct {

	// Types that are assignable to Embedding:
	//
	//	*Embedding_Openai
	Embedding isEmbedding_Embedding `protobuf_oneof:"embedding"`
	// contains filtered or unexported fields
}

func (*Embedding) Clone

func (m *Embedding) Clone() proto.Message

Clone function

func (*Embedding) Descriptor deprecated

func (*Embedding) Descriptor() ([]byte, []int)

Deprecated: Use Embedding.ProtoReflect.Descriptor instead.

func (*Embedding) Equal

func (m *Embedding) Equal(that interface{}) bool

Equal function

func (*Embedding) GetEmbedding

func (m *Embedding) GetEmbedding() isEmbedding_Embedding

func (*Embedding) GetOpenai

func (x *Embedding) GetOpenai() *Embedding_OpenAI

func (*Embedding) Hash

func (m *Embedding) Hash(hasher hash.Hash64) (uint64, error)

Hash function

func (*Embedding) ProtoMessage

func (*Embedding) ProtoMessage()

func (*Embedding) ProtoReflect

func (x *Embedding) ProtoReflect() protoreflect.Message

func (*Embedding) Reset

func (x *Embedding) Reset()

func (*Embedding) String

func (x *Embedding) String() string

type Embedding_OpenAI

type Embedding_OpenAI struct {

	// Types that are assignable to AuthTokenSource:
	//
	//	*Embedding_OpenAI_AuthToken
	AuthTokenSource isEmbedding_OpenAI_AuthTokenSource `protobuf_oneof:"auth_token_source"`
	// contains filtered or unexported fields
}

func (*Embedding_OpenAI) Clone

func (m *Embedding_OpenAI) Clone() proto.Message

Clone function

func (*Embedding_OpenAI) Descriptor deprecated

func (*Embedding_OpenAI) Descriptor() ([]byte, []int)

Deprecated: Use Embedding_OpenAI.ProtoReflect.Descriptor instead.

func (*Embedding_OpenAI) Equal

func (m *Embedding_OpenAI) Equal(that interface{}) bool

Equal function

func (*Embedding_OpenAI) GetAuthToken

func (x *Embedding_OpenAI) GetAuthToken() *SingleAuthToken

func (*Embedding_OpenAI) GetAuthTokenSource

func (m *Embedding_OpenAI) GetAuthTokenSource() isEmbedding_OpenAI_AuthTokenSource

func (*Embedding_OpenAI) Hash

func (m *Embedding_OpenAI) Hash(hasher hash.Hash64) (uint64, error)

Hash function

func (*Embedding_OpenAI) ProtoMessage

func (*Embedding_OpenAI) ProtoMessage()

func (*Embedding_OpenAI) ProtoReflect

func (x *Embedding_OpenAI) ProtoReflect() protoreflect.Message

func (*Embedding_OpenAI) Reset

func (x *Embedding_OpenAI) Reset()

func (*Embedding_OpenAI) String

func (x *Embedding_OpenAI) String() string

type Embedding_OpenAI_AuthToken

type Embedding_OpenAI_AuthToken struct {
	AuthToken *SingleAuthToken `protobuf:"bytes,1,opt,name=auth_token,json=authToken,proto3,oneof"`
}

type Embedding_Openai

type Embedding_Openai struct {
	Openai *Embedding_OpenAI `protobuf:"bytes,1,opt,name=openai,proto3,oneof"`
}

type FieldDefault

type FieldDefault struct {

	// Field name
	Field string `protobuf:"bytes,1,opt,name=field,proto3" json:"field,omitempty"`
	// Field Value, this can be any valid JSON value
	Value *_struct.Value `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	// Whether or not to override the field if it already exists
	Override bool `protobuf:"varint,3,opt,name=override,proto3" json:"override,omitempty"`
	// contains filtered or unexported fields
}

func (*FieldDefault) Clone

func (m *FieldDefault) Clone() proto.Message

Clone function

func (*FieldDefault) Descriptor deprecated

func (*FieldDefault) Descriptor() ([]byte, []int)

Deprecated: Use FieldDefault.ProtoReflect.Descriptor instead.

func (*FieldDefault) Equal

func (m *FieldDefault) Equal(that interface{}) bool

Equal function

func (*FieldDefault) GetField

func (x *FieldDefault) GetField() string

func (*FieldDefault) GetOverride

func (x *FieldDefault) GetOverride() bool

func (*FieldDefault) GetValue

func (x *FieldDefault) GetValue() *_struct.Value

func (*FieldDefault) Hash

func (m *FieldDefault) Hash(hasher hash.Hash64) (uint64, error)

Hash function

func (*FieldDefault) ProtoMessage

func (*FieldDefault) ProtoMessage()

func (*FieldDefault) ProtoReflect

func (x *FieldDefault) ProtoReflect() protoreflect.Message

func (*FieldDefault) Reset

func (x *FieldDefault) Reset()

func (*FieldDefault) String

func (x *FieldDefault) String() string

type Postgres

type Postgres struct {

	// Connection string to the Postgres database
	ConnectionString string `protobuf:"bytes,1,opt,name=connection_string,json=connectionString,proto3" json:"connection_string,omitempty"`
	// Name of the table to use
	CollectionName string `protobuf:"bytes,2,opt,name=collection_name,json=collectionName,proto3" json:"collection_name,omitempty"`
	// contains filtered or unexported fields
}

func (*Postgres) Clone

func (m *Postgres) Clone() proto.Message

Clone function

func (*Postgres) Descriptor deprecated

func (*Postgres) Descriptor() ([]byte, []int)

Deprecated: Use Postgres.ProtoReflect.Descriptor instead.

func (*Postgres) Equal

func (m *Postgres) Equal(that interface{}) bool

Equal function

func (*Postgres) GetCollectionName

func (x *Postgres) GetCollectionName() string

func (*Postgres) GetConnectionString

func (x *Postgres) GetConnectionString() string

func (*Postgres) Hash

func (m *Postgres) Hash(hasher hash.Hash64) (uint64, error)

Hash function

func (*Postgres) ProtoMessage

func (*Postgres) ProtoMessage()

func (*Postgres) ProtoReflect

func (x *Postgres) ProtoReflect() protoreflect.Message

func (*Postgres) Reset

func (x *Postgres) Reset()

func (*Postgres) String

func (x *Postgres) String() string

type RAG

type RAG struct {

	// Data store from which to fetch the embeddings
	Datastore *RAG_DataStore `protobuf:"bytes,1,opt,name=datastore,proto3" json:"datastore,omitempty"`
	// Model to use to get embeddings for prompt
	Embedding *Embedding `protobuf:"bytes,2,opt,name=embedding,proto3" json:"embedding,omitempty"`
	// Template to use to embed the returned context
	PromptTemplate string `protobuf:"bytes,3,opt,name=prompt_template,json=promptTemplate,proto3" json:"prompt_template,omitempty"`
	// contains filtered or unexported fields
}

func (*RAG) Clone

func (m *RAG) Clone() proto.Message

Clone function

func (*RAG) Descriptor deprecated

func (*RAG) Descriptor() ([]byte, []int)

Deprecated: Use RAG.ProtoReflect.Descriptor instead.

func (*RAG) Equal

func (m *RAG) Equal(that interface{}) bool

Equal function

func (*RAG) GetDatastore

func (x *RAG) GetDatastore() *RAG_DataStore

func (*RAG) GetEmbedding

func (x *RAG) GetEmbedding() *Embedding

func (*RAG) GetPromptTemplate

func (x *RAG) GetPromptTemplate() string

func (*RAG) Hash

func (m *RAG) Hash(hasher hash.Hash64) (uint64, error)

Hash function

func (*RAG) ProtoMessage

func (*RAG) ProtoMessage()

func (*RAG) ProtoReflect

func (x *RAG) ProtoReflect() protoreflect.Message

func (*RAG) Reset

func (x *RAG) Reset()

func (*RAG) String

func (x *RAG) String() string

type RAG_DataStore

type RAG_DataStore struct {

	// Types that are assignable to Datastore:
	//
	//	*RAG_DataStore_Postgres
	Datastore isRAG_DataStore_Datastore `protobuf_oneof:"datastore"`
	// contains filtered or unexported fields
}

func (*RAG_DataStore) Clone

func (m *RAG_DataStore) Clone() proto.Message

Clone function

func (*RAG_DataStore) Descriptor deprecated

func (*RAG_DataStore) Descriptor() ([]byte, []int)

Deprecated: Use RAG_DataStore.ProtoReflect.Descriptor instead.

func (*RAG_DataStore) Equal

func (m *RAG_DataStore) Equal(that interface{}) bool

Equal function

func (*RAG_DataStore) GetDatastore

func (m *RAG_DataStore) GetDatastore() isRAG_DataStore_Datastore

func (*RAG_DataStore) GetPostgres

func (x *RAG_DataStore) GetPostgres() *Postgres

func (*RAG_DataStore) Hash

func (m *RAG_DataStore) Hash(hasher hash.Hash64) (uint64, error)

Hash function

func (*RAG_DataStore) ProtoMessage

func (*RAG_DataStore) ProtoMessage()

func (*RAG_DataStore) ProtoReflect

func (x *RAG_DataStore) ProtoReflect() protoreflect.Message

func (*RAG_DataStore) Reset

func (x *RAG_DataStore) Reset()

func (*RAG_DataStore) String

func (x *RAG_DataStore) String() string

type RAG_DataStore_Postgres

type RAG_DataStore_Postgres struct {
	Postgres *Postgres `protobuf:"bytes,1,opt,name=postgres,proto3,oneof"`
}

type RateLimiting

type RateLimiting struct {

	// List of rate_limit configs to apply
	RateLimitConfigs []string `protobuf:"bytes,1,rep,name=rate_limit_configs,json=rateLimitConfigs,proto3" json:"rate_limit_configs,omitempty"`
	// contains filtered or unexported fields
}

func (*RateLimiting) Clone

func (m *RateLimiting) Clone() proto.Message

Clone function

func (*RateLimiting) Descriptor deprecated

func (*RateLimiting) Descriptor() ([]byte, []int)

Deprecated: Use RateLimiting.ProtoReflect.Descriptor instead.

func (*RateLimiting) Equal

func (m *RateLimiting) Equal(that interface{}) bool

Equal function

func (*RateLimiting) GetRateLimitConfigs

func (x *RateLimiting) GetRateLimitConfigs() []string

func (*RateLimiting) Hash

func (m *RateLimiting) Hash(hasher hash.Hash64) (uint64, error)

Hash function

func (*RateLimiting) ProtoMessage

func (*RateLimiting) ProtoMessage()

func (*RateLimiting) ProtoReflect

func (x *RateLimiting) ProtoReflect() protoreflect.Message

func (*RateLimiting) Reset

func (x *RateLimiting) Reset()

func (*RateLimiting) String

func (x *RateLimiting) String() string

type RouteSettings

type RouteSettings struct {

	// Config used to enrich the prompt. This can only be used with LLMProviders using the CHAT API type.
	//
	// Prompt enrichment allows you to add additional context to the prompt before sending it to the model.
	// Unlike RAG or other dynamic context methods, prompt enrichment is static and will be applied to every request.
	//
	// Note: Some providers, including Anthropic do not support SYSTEM role messages, but rather have a dedicated
	// system field in the input JSON. In this case, `field_defaults` should be used to set the system field. See the docs
	// for that field for an example.
	//
	// Example:
	// “`
	// 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"
	// “`
	PromptEnrichment *AIPromptEnrichment `protobuf:"bytes,1,opt,name=prompt_enrichment,json=promptEnrichment,proto3" json:"prompt_enrichment,omitempty"`
	// Guards to apply to the LLM requests on this route.
	// This can be used to reject requests based on the content of the prompt, as well as
	// mask responses based on the content of the response. These guards can be also be used
	// at the same time.
	//
	// Below is a simple example of a prompt guard that will reject any prompt that contains
	// the string "credit card" and will mask any credit card numbers in the response.
	//
	// “`
	// promptGuard:
	// request:
	// customResponseMessage: "Rejected due to inappropriate content"
	// matches:
	// - "credit card"
	// response:
	// matches:
	// # Mastercard
	// - '(?:^|\D)(5[1-5][0-9]{2}(?:\ |\-|)[0-9]{4}(?:\ |\-|)[0-9]{4}(?:\ |\-|)[0-9]{4})(?:\D|$)'
	// ““
	PromptGuard *AIPromptGaurd `protobuf:"bytes,2,opt,name=prompt_guard,json=promptGuard,proto3" json:"prompt_guard,omitempty"`
	// Retrieval Augmented Generation. https://research.ibm.com/blog/retrieval-augmented-generation-RAG
	// Retrieval Augmented Generation is a process by which you "augment" the information
	// a model has access to by providing it with a set of documents to use as context.
	// This can be used to improve the quality of the generated text.
	// Important Note: The same embedding mechanism must be used for the prompt
	// which was used for the initial creation of the context documents.
	//
	// Example using postgres for storage and OpenAI for embedding:
	// “`
	// rag:
	// datastore:
	// postgres:
	// connectionString: postgresql+psycopg://gloo:gloo@172.17.0.1:6024/gloo
	// collectionName: default
	// embedding:
	// openai:
	// authToken:
	// secretRef:
	// name: openai-secret
	// namespace: gloo-system
	// “`
	Rag *RAG `protobuf:"bytes,3,opt,name=rag,proto3" json:"rag,omitempty"`
	// Semantic caching configuration
	// Semantic caching allows you to cache previous model responses in order to provide
	// faster responses to similar requests in the future.
	// Results will vary depending on the embedding mechanism used, as well
	// as the similarity threshold set.
	//
	// Example using Redis for storage and OpenAI for embedding:
	// “`
	// semanticCache:
	// datastore:
	// redis:
	// connectionString: redis://172.17.0.1:6379
	// embedding:
	// openai:
	// authToken:
	// secretRef:
	// name: openai-secret
	// namespace: gloo-system
	// “`
	SemanticCache *SemanticCache `protobuf:"bytes,4,opt,name=semantic_cache,json=semanticCache,proto3" json:"semantic_cache,omitempty"`
	// Backup models to use in case of a failure with the primary model
	// passed in the request. By default each model will be tried 2 times
	// before moving on to the next model in the list. If all requests fail then
	// the final response will be returned to the client.
	BackupModels []string `protobuf:"bytes,5,rep,name=backup_models,json=backupModels,proto3" json:"backup_models,omitempty"`
	// A list of defaults to be merged with the user input fields.
	// These will NOT override the user input fields unless override is explicitly set to true.
	// Some examples include setting the temperature, max_tokens, etc.
	//
	// Example overriding system field for Anthropic:
	// “`
	// # Anthropic doesn't support a system chat type
	// defaults:
	// - field: "system"
	// value: "answer all questions in french"
	// “`
	//
	// Example setting the temperature and max_tokens, overriding max_tokens:
	// “`
	// defaults:
	// - field: "temperature"
	// value: 0.5
	// - field: "max_tokens"
	// value: 100
	// “`
	Defaults []*FieldDefault `protobuf:"bytes,6,rep,name=defaults,proto3" json:"defaults,omitempty"`
	// contains filtered or unexported fields
}

RouteSettings is a way to configure the behavior of the LLM provider on a per-route basis This allows users to configure things like: - Prompt Enrichment - Retrieval Augmented Generation - Semantic Caching - Backup Models - Defaults to merge with the user input fields - Guardrails

NOTE: These settings may only be applied to a route which uses an LLMProvider backend!

func (*RouteSettings) Clone

func (m *RouteSettings) Clone() proto.Message

Clone function

func (*RouteSettings) Descriptor deprecated

func (*RouteSettings) Descriptor() ([]byte, []int)

Deprecated: Use RouteSettings.ProtoReflect.Descriptor instead.

func (*RouteSettings) Equal

func (m *RouteSettings) Equal(that interface{}) bool

Equal function

func (*RouteSettings) GetBackupModels

func (x *RouteSettings) GetBackupModels() []string

func (*RouteSettings) GetDefaults

func (x *RouteSettings) GetDefaults() []*FieldDefault

func (*RouteSettings) GetPromptEnrichment

func (x *RouteSettings) GetPromptEnrichment() *AIPromptEnrichment

func (*RouteSettings) GetPromptGuard

func (x *RouteSettings) GetPromptGuard() *AIPromptGaurd

func (*RouteSettings) GetRag

func (x *RouteSettings) GetRag() *RAG

func (*RouteSettings) GetSemanticCache

func (x *RouteSettings) GetSemanticCache() *SemanticCache

func (*RouteSettings) Hash

func (m *RouteSettings) Hash(hasher hash.Hash64) (uint64, error)

Hash function

func (*RouteSettings) ProtoMessage

func (*RouteSettings) ProtoMessage()

func (*RouteSettings) ProtoReflect

func (x *RouteSettings) ProtoReflect() protoreflect.Message

func (*RouteSettings) Reset

func (x *RouteSettings) Reset()

func (*RouteSettings) String

func (x *RouteSettings) String() string

type SemanticCache

type SemanticCache struct {

	// Which data store to use
	Datastore *SemanticCache_DataStore `protobuf:"bytes,1,opt,name=datastore,proto3" json:"datastore,omitempty"`
	// Model to use to get embeddings for prompt
	Embedding *Embedding `protobuf:"bytes,2,opt,name=embedding,proto3" json:"embedding,omitempty"`
	// Time before data in the cache is considered expired
	Ttl uint32 `protobuf:"varint,3,opt,name=ttl,proto3" json:"ttl,omitempty"`
	// contains filtered or unexported fields
}

func (*SemanticCache) Clone

func (m *SemanticCache) Clone() proto.Message

Clone function

func (*SemanticCache) Descriptor deprecated

func (*SemanticCache) Descriptor() ([]byte, []int)

Deprecated: Use SemanticCache.ProtoReflect.Descriptor instead.

func (*SemanticCache) Equal

func (m *SemanticCache) Equal(that interface{}) bool

Equal function

func (*SemanticCache) GetDatastore

func (x *SemanticCache) GetDatastore() *SemanticCache_DataStore

func (*SemanticCache) GetEmbedding

func (x *SemanticCache) GetEmbedding() *Embedding

func (*SemanticCache) GetTtl

func (x *SemanticCache) GetTtl() uint32

func (*SemanticCache) Hash

func (m *SemanticCache) Hash(hasher hash.Hash64) (uint64, error)

Hash function

func (*SemanticCache) ProtoMessage

func (*SemanticCache) ProtoMessage()

func (*SemanticCache) ProtoReflect

func (x *SemanticCache) ProtoReflect() protoreflect.Message

func (*SemanticCache) Reset

func (x *SemanticCache) Reset()

func (*SemanticCache) String

func (x *SemanticCache) String() string

type SemanticCache_DataStore

type SemanticCache_DataStore struct {

	// Types that are assignable to Datastore:
	//
	//	*SemanticCache_DataStore_Redis
	Datastore isSemanticCache_DataStore_Datastore `protobuf_oneof:"datastore"`
	// contains filtered or unexported fields
}

Data store from which to cache the request/response pairs

func (*SemanticCache_DataStore) Clone

Clone function

func (*SemanticCache_DataStore) Descriptor deprecated

func (*SemanticCache_DataStore) Descriptor() ([]byte, []int)

Deprecated: Use SemanticCache_DataStore.ProtoReflect.Descriptor instead.

func (*SemanticCache_DataStore) Equal

func (m *SemanticCache_DataStore) Equal(that interface{}) bool

Equal function

func (*SemanticCache_DataStore) GetDatastore

func (m *SemanticCache_DataStore) GetDatastore() isSemanticCache_DataStore_Datastore

func (*SemanticCache_DataStore) GetRedis

func (*SemanticCache_DataStore) Hash

func (m *SemanticCache_DataStore) Hash(hasher hash.Hash64) (uint64, error)

Hash function

func (*SemanticCache_DataStore) ProtoMessage

func (*SemanticCache_DataStore) ProtoMessage()

func (*SemanticCache_DataStore) ProtoReflect

func (x *SemanticCache_DataStore) ProtoReflect() protoreflect.Message

func (*SemanticCache_DataStore) Reset

func (x *SemanticCache_DataStore) Reset()

func (*SemanticCache_DataStore) String

func (x *SemanticCache_DataStore) String() string

type SemanticCache_DataStore_Redis

type SemanticCache_DataStore_Redis struct {
	Redis *SemanticCache_Redis `protobuf:"bytes,1,opt,name=redis,proto3,oneof"`
}

type SemanticCache_Redis

type SemanticCache_Redis struct {

	// Connection string to the Redis database
	ConnectionString string `protobuf:"bytes,1,opt,name=connection_string,json=connectionString,proto3" json:"connection_string,omitempty"`
	// contains filtered or unexported fields
}

func (*SemanticCache_Redis) Clone

func (m *SemanticCache_Redis) Clone() proto.Message

Clone function

func (*SemanticCache_Redis) Descriptor deprecated

func (*SemanticCache_Redis) Descriptor() ([]byte, []int)

Deprecated: Use SemanticCache_Redis.ProtoReflect.Descriptor instead.

func (*SemanticCache_Redis) Equal

func (m *SemanticCache_Redis) Equal(that interface{}) bool

Equal function

func (*SemanticCache_Redis) GetConnectionString

func (x *SemanticCache_Redis) GetConnectionString() string

func (*SemanticCache_Redis) Hash

func (m *SemanticCache_Redis) Hash(hasher hash.Hash64) (uint64, error)

Hash function

func (*SemanticCache_Redis) ProtoMessage

func (*SemanticCache_Redis) ProtoMessage()

func (*SemanticCache_Redis) ProtoReflect

func (x *SemanticCache_Redis) ProtoReflect() protoreflect.Message

func (*SemanticCache_Redis) Reset

func (x *SemanticCache_Redis) Reset()

func (*SemanticCache_Redis) String

func (x *SemanticCache_Redis) String() string

type SingleAuthToken

type SingleAuthToken struct {

	// Types that are assignable to AuthTokenSource:
	//
	//	*SingleAuthToken_Inline
	//	*SingleAuthToken_SecretRef
	AuthTokenSource isSingleAuthToken_AuthTokenSource `protobuf_oneof:"auth_token_source"`
	// contains filtered or unexported fields
}

func (*SingleAuthToken) Clone

func (m *SingleAuthToken) Clone() proto.Message

Clone function

func (*SingleAuthToken) Descriptor deprecated

func (*SingleAuthToken) Descriptor() ([]byte, []int)

Deprecated: Use SingleAuthToken.ProtoReflect.Descriptor instead.

func (*SingleAuthToken) Equal

func (m *SingleAuthToken) Equal(that interface{}) bool

Equal function

func (*SingleAuthToken) GetAuthTokenSource

func (m *SingleAuthToken) GetAuthTokenSource() isSingleAuthToken_AuthTokenSource

func (*SingleAuthToken) GetInline

func (x *SingleAuthToken) GetInline() string

func (*SingleAuthToken) GetSecretRef

func (x *SingleAuthToken) GetSecretRef() *core.ResourceRef

func (*SingleAuthToken) Hash

func (m *SingleAuthToken) Hash(hasher hash.Hash64) (uint64, error)

Hash function

func (*SingleAuthToken) ProtoMessage

func (*SingleAuthToken) ProtoMessage()

func (*SingleAuthToken) ProtoReflect

func (x *SingleAuthToken) ProtoReflect() protoreflect.Message

func (*SingleAuthToken) Reset

func (x *SingleAuthToken) Reset()

func (*SingleAuthToken) String

func (x *SingleAuthToken) String() string

type SingleAuthToken_Inline

type SingleAuthToken_Inline struct {
	// Provide easy inline way to specify a token
	Inline string `protobuf:"bytes,1,opt,name=inline,proto3,oneof"`
}

type SingleAuthToken_SecretRef

type SingleAuthToken_SecretRef struct {
	// Reference to a secret in the same namespace as the Upstream
	SecretRef *core.ResourceRef `protobuf:"bytes,2,opt,name=secret_ref,json=secretRef,proto3,oneof"`
}

type UpstreamSpec

type UpstreamSpec struct {

	// Types that are assignable to Llm:
	//
	//	*UpstreamSpec_Openai
	//	*UpstreamSpec_Mistral_
	//	*UpstreamSpec_Anthropic_
	Llm isUpstreamSpec_Llm `protobuf_oneof:"llm"`
	// contains filtered or unexported fields
}

The AI UpstreamSpec represents a logical LLM provider backend. The purpose of this spec is a way to configure which backend to use as well as how to authenticate with the backend.

Currently the options are: - OpenAI Default Host: api.openai.com Default Port: 443 Auth Token: Bearer token to use for the OpenAI API - Mistral Default Host: api.mistral.com Default Port: 443 Auth Token: Bearer token to use for the Mistral API - Anthropic Default Host: api.anthropic.com Default Port: 443 Auth Token: x-api-key to use for the Anthropic API Version: Optional version header to pass to the Anthropic API

All of the above backends can be configured to use a custom host and port. This option is meant to allow users to proxy the request, or to use a different backend altogether which is API compliant with the upstream version.

Examples:

OpenAI with inline auth token: ``` ai: openai: authToken: inline: "my_token" ```

Mistral with secret ref: ``` ai: mistral: authToken: secretRef: name: "my-secret" namespace: "my-ns" ```

Anthropic with inline token and custom Host: ``` ai: anthropic: authToken: inline: "my_token" customHost: host: "my-anthropic-host.com" port: 443 # Port is optional and will default to 443 for HTTPS ```

func (*UpstreamSpec) Clone

func (m *UpstreamSpec) Clone() proto.Message

Clone function

func (*UpstreamSpec) Descriptor deprecated

func (*UpstreamSpec) Descriptor() ([]byte, []int)

Deprecated: Use UpstreamSpec.ProtoReflect.Descriptor instead.

func (*UpstreamSpec) Equal

func (m *UpstreamSpec) Equal(that interface{}) bool

Equal function

func (*UpstreamSpec) GetAnthropic

func (x *UpstreamSpec) GetAnthropic() *UpstreamSpec_Anthropic

func (*UpstreamSpec) GetLlm

func (m *UpstreamSpec) GetLlm() isUpstreamSpec_Llm

func (*UpstreamSpec) GetMistral

func (x *UpstreamSpec) GetMistral() *UpstreamSpec_Mistral

func (*UpstreamSpec) GetOpenai

func (x *UpstreamSpec) GetOpenai() *UpstreamSpec_OpenAI

func (*UpstreamSpec) Hash

func (m *UpstreamSpec) Hash(hasher hash.Hash64) (uint64, error)

Hash function

func (*UpstreamSpec) ProtoMessage

func (*UpstreamSpec) ProtoMessage()

func (*UpstreamSpec) ProtoReflect

func (x *UpstreamSpec) ProtoReflect() protoreflect.Message

func (*UpstreamSpec) Reset

func (x *UpstreamSpec) Reset()

func (*UpstreamSpec) String

func (x *UpstreamSpec) String() string

type UpstreamSpec_Anthropic

type UpstreamSpec_Anthropic struct {

	// Auth Token to use for the Anthropic API.
	// This token will be placed into the `x-api-key` header
	// when sending the request to the upstream.
	AuthToken  *SingleAuthToken         `protobuf:"bytes,1,opt,name=auth_token,json=authToken,proto3" json:"auth_token,omitempty"`
	CustomHost *UpstreamSpec_CustomHost `protobuf:"bytes,2,opt,name=custom_host,json=customHost,proto3" json:"custom_host,omitempty"`
	// An optional version header to pass to the Anthropic API
	// See: https://docs.anthropic.com/en/api/versioning for more details
	Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"`
	// contains filtered or unexported fields
}

func (*UpstreamSpec_Anthropic) Clone

Clone function

func (*UpstreamSpec_Anthropic) Descriptor deprecated

func (*UpstreamSpec_Anthropic) Descriptor() ([]byte, []int)

Deprecated: Use UpstreamSpec_Anthropic.ProtoReflect.Descriptor instead.

func (*UpstreamSpec_Anthropic) Equal

func (m *UpstreamSpec_Anthropic) Equal(that interface{}) bool

Equal function

func (*UpstreamSpec_Anthropic) GetAuthToken

func (x *UpstreamSpec_Anthropic) GetAuthToken() *SingleAuthToken

func (*UpstreamSpec_Anthropic) GetCustomHost

func (x *UpstreamSpec_Anthropic) GetCustomHost() *UpstreamSpec_CustomHost

func (*UpstreamSpec_Anthropic) GetVersion

func (x *UpstreamSpec_Anthropic) GetVersion() string

func (*UpstreamSpec_Anthropic) Hash

func (m *UpstreamSpec_Anthropic) Hash(hasher hash.Hash64) (uint64, error)

Hash function

func (*UpstreamSpec_Anthropic) ProtoMessage

func (*UpstreamSpec_Anthropic) ProtoMessage()

func (*UpstreamSpec_Anthropic) ProtoReflect

func (x *UpstreamSpec_Anthropic) ProtoReflect() protoreflect.Message

func (*UpstreamSpec_Anthropic) Reset

func (x *UpstreamSpec_Anthropic) Reset()

func (*UpstreamSpec_Anthropic) String

func (x *UpstreamSpec_Anthropic) String() string

type UpstreamSpec_Anthropic_

type UpstreamSpec_Anthropic_ struct {
	Anthropic *UpstreamSpec_Anthropic `protobuf:"bytes,3,opt,name=anthropic,proto3,oneof"`
}

type UpstreamSpec_CustomHost

type UpstreamSpec_CustomHost struct {

	// Custom host to send the traffic to
	Host string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"`
	// Custom host to send the traffic to
	Port uint32 `protobuf:"varint,2,opt,name=port,proto3" json:"port,omitempty"`
	// contains filtered or unexported fields
}

func (*UpstreamSpec_CustomHost) Clone

Clone function

func (*UpstreamSpec_CustomHost) Descriptor deprecated

func (*UpstreamSpec_CustomHost) Descriptor() ([]byte, []int)

Deprecated: Use UpstreamSpec_CustomHost.ProtoReflect.Descriptor instead.

func (*UpstreamSpec_CustomHost) Equal

func (m *UpstreamSpec_CustomHost) Equal(that interface{}) bool

Equal function

func (*UpstreamSpec_CustomHost) GetHost

func (x *UpstreamSpec_CustomHost) GetHost() string

func (*UpstreamSpec_CustomHost) GetPort

func (x *UpstreamSpec_CustomHost) GetPort() uint32

func (*UpstreamSpec_CustomHost) Hash

func (m *UpstreamSpec_CustomHost) Hash(hasher hash.Hash64) (uint64, error)

Hash function

func (*UpstreamSpec_CustomHost) ProtoMessage

func (*UpstreamSpec_CustomHost) ProtoMessage()

func (*UpstreamSpec_CustomHost) ProtoReflect

func (x *UpstreamSpec_CustomHost) ProtoReflect() protoreflect.Message

func (*UpstreamSpec_CustomHost) Reset

func (x *UpstreamSpec_CustomHost) Reset()

func (*UpstreamSpec_CustomHost) String

func (x *UpstreamSpec_CustomHost) String() string

type UpstreamSpec_Mistral

type UpstreamSpec_Mistral struct {

	// Auth Token to use for the Mistral API.
	// This token will be placed into the `Authorization` header
	// and prefixed with Bearer if not present
	// when sending the request to the upstream.
	AuthToken *SingleAuthToken `protobuf:"bytes,1,opt,name=auth_token,json=authToken,proto3" json:"auth_token,omitempty"`
	// Optional custom host to send the traffic to
	CustomHost *UpstreamSpec_CustomHost `protobuf:"bytes,2,opt,name=custom_host,json=customHost,proto3" json:"custom_host,omitempty"`
	// contains filtered or unexported fields
}

Settings for the Mistral API

func (*UpstreamSpec_Mistral) Clone

func (m *UpstreamSpec_Mistral) Clone() proto.Message

Clone function

func (*UpstreamSpec_Mistral) Descriptor deprecated

func (*UpstreamSpec_Mistral) Descriptor() ([]byte, []int)

Deprecated: Use UpstreamSpec_Mistral.ProtoReflect.Descriptor instead.

func (*UpstreamSpec_Mistral) Equal

func (m *UpstreamSpec_Mistral) Equal(that interface{}) bool

Equal function

func (*UpstreamSpec_Mistral) GetAuthToken

func (x *UpstreamSpec_Mistral) GetAuthToken() *SingleAuthToken

func (*UpstreamSpec_Mistral) GetCustomHost

func (x *UpstreamSpec_Mistral) GetCustomHost() *UpstreamSpec_CustomHost

func (*UpstreamSpec_Mistral) Hash

func (m *UpstreamSpec_Mistral) Hash(hasher hash.Hash64) (uint64, error)

Hash function

func (*UpstreamSpec_Mistral) ProtoMessage

func (*UpstreamSpec_Mistral) ProtoMessage()

func (*UpstreamSpec_Mistral) ProtoReflect

func (x *UpstreamSpec_Mistral) ProtoReflect() protoreflect.Message

func (*UpstreamSpec_Mistral) Reset

func (x *UpstreamSpec_Mistral) Reset()

func (*UpstreamSpec_Mistral) String

func (x *UpstreamSpec_Mistral) String() string

type UpstreamSpec_Mistral_

type UpstreamSpec_Mistral_ struct {
	Mistral *UpstreamSpec_Mistral `protobuf:"bytes,2,opt,name=mistral,proto3,oneof"`
}

type UpstreamSpec_OpenAI

type UpstreamSpec_OpenAI struct {

	// Auth Token to use for the OpenAI API
	// This token will be placed into the `Authorization` header
	// and prefixed with Bearer if not present
	// when sending the request to the upstream.
	AuthToken *SingleAuthToken `protobuf:"bytes,1,opt,name=auth_token,json=authToken,proto3" json:"auth_token,omitempty"`
	// Optional custom host to send the traffic to
	CustomHost *UpstreamSpec_CustomHost `protobuf:"bytes,2,opt,name=custom_host,json=customHost,proto3" json:"custom_host,omitempty"`
	// contains filtered or unexported fields
}

Settings for the OpenAI API

func (*UpstreamSpec_OpenAI) Clone

func (m *UpstreamSpec_OpenAI) Clone() proto.Message

Clone function

func (*UpstreamSpec_OpenAI) Descriptor deprecated

func (*UpstreamSpec_OpenAI) Descriptor() ([]byte, []int)

Deprecated: Use UpstreamSpec_OpenAI.ProtoReflect.Descriptor instead.

func (*UpstreamSpec_OpenAI) Equal

func (m *UpstreamSpec_OpenAI) Equal(that interface{}) bool

Equal function

func (*UpstreamSpec_OpenAI) GetAuthToken

func (x *UpstreamSpec_OpenAI) GetAuthToken() *SingleAuthToken

func (*UpstreamSpec_OpenAI) GetCustomHost

func (x *UpstreamSpec_OpenAI) GetCustomHost() *UpstreamSpec_CustomHost

func (*UpstreamSpec_OpenAI) Hash

func (m *UpstreamSpec_OpenAI) Hash(hasher hash.Hash64) (uint64, error)

Hash function

func (*UpstreamSpec_OpenAI) ProtoMessage

func (*UpstreamSpec_OpenAI) ProtoMessage()

func (*UpstreamSpec_OpenAI) ProtoReflect

func (x *UpstreamSpec_OpenAI) ProtoReflect() protoreflect.Message

func (*UpstreamSpec_OpenAI) Reset

func (x *UpstreamSpec_OpenAI) Reset()

func (*UpstreamSpec_OpenAI) String

func (x *UpstreamSpec_OpenAI) String() string

type UpstreamSpec_Openai

type UpstreamSpec_Openai struct {
	Openai *UpstreamSpec_OpenAI `protobuf:"bytes,1,opt,name=openai,proto3,oneof"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL