Documentation ¶
Index ¶
- Variables
- func SerializeApp(app types.Application) ([]byte, error)
- func SerializeDatabase(db types.Database) ([]byte, error)
- func SerializeKubeCluster(cluster types.KubeCluster) ([]byte, error)
- func SerializeNode(node types.Server) ([]byte, error)
- func SerializeResource(resource types.Resource) ([]byte, error)
- func SerializeWindowsDesktop(desktop types.WindowsDesktop) ([]byte, error)
- type Embedder
- type Embedding
- type Sha256Hash
- type Vector32
- type Vector64
Constants ¶
This section is empty.
Variables ¶
var EmbeddingHash = sha256.Sum256
EmbeddingHash is the hash function that should be used to compute embedding hashes.
Functions ¶
func SerializeApp ¶
func SerializeApp(app types.Application) ([]byte, error)
SerializeApp converts a type.Application into text ready to be fed to an embedding model. The YAML serialization function was chosen over JSON and CSV as it provided better results.
func SerializeDatabase ¶
SerializeDatabase converts a type.Database into text ready to be fed to an embedding model. The YAML serialization function was chosen over JSON and CSV as it provided better results.
func SerializeKubeCluster ¶
func SerializeKubeCluster(cluster types.KubeCluster) ([]byte, error)
SerializeKubeCluster converts a type.KubeCluster into text ready to be fed to an embedding model. The YAML serialization function was chosen over JSON and CSV as it provided better results.
func SerializeNode ¶
SerializeNode converts a type.Server into text ready to be fed to an embedding model. The YAML serialization function was chosen over JSON and CSV as it provided better results.
func SerializeResource ¶
SerializeNode converts a serializable resource into text ready to be fed to an embedding model. The YAML serialization function was chosen over JSON and CSV as it provided better results.
func SerializeWindowsDesktop ¶
func SerializeWindowsDesktop(desktop types.WindowsDesktop) ([]byte, error)
SerializeWindowsDesktop converts a type.WindowsDesktop into text ready to be fed to an embedding model. The YAML serialization function was chosen over JSON and CSV as it provided better results.
Types ¶
type Embedder ¶
type Embedder interface { // ComputeEmbeddings computes the embeddings of multiple strings. // The embedding list follows the input order (e.g., result[i] is the // embedding of input[i]). ComputeEmbeddings(ctx context.Context, input []string) ([]Vector64, error) }
Embedder is implemented for batch text embedding. Embedding can happen in place (with an embedding model, for example) or be done by a remote embedding service like OpenAI.
type Embedding ¶
type Embedding embeddingpb.Embedding
Embedding contains a Teleport resource embedding. Embeddings are small semantic representations of larger and more complex data. Embeddings can be compared, the smaller the distance between two vectors, the closer the concepts are. Teleport Assist embeds resources to perform semantic search. The Embedding is named after the embedded resource id and kind. For example the SSH node "bastion-01" has the embedding "node/bastion-01".
func NewEmbedding ¶
func NewEmbedding(kind, id string, vector Vector64, hash Sha256Hash) *Embedding
NewEmbedding is an Embedding constructor.
func (*Embedding) Dimension ¶
Dimension returns the value of the i-th dimension Implements kdtree.Point interface
func (*Embedding) Dimensions ¶
Dimensions returns the number of dimensions of the embedding Implements kdtree.Point interface
func (*Embedding) GetEmbeddedID ¶
GetEmbeddedID returns the ID of the resource that was embedded.
func (*Embedding) GetEmbeddedKind ¶
GetEmbeddedKind returns the kind of the resource that was embedded.
type Sha256Hash ¶
Sha256Hash is the hash of the embedded content. This hash allows to detect if the embedding is still up-to-date or if the content changed and the resource must be re-embedded.