From 20d4d6f806a58c07a22399c1bc82ae5d4f84461b Mon Sep 17 00:00:00 2001 From: Keith Randall Date: Tue, 28 May 2024 10:57:08 -0700 Subject: [PATCH 1/2] Clean up doc strings, make them more clickable. --- go/plugins/googleai/embed.go | 2 +- go/plugins/googleai/googleai.go | 4 ++-- go/plugins/pinecone/genkit.go | 2 +- go/plugins/vertexai/embed.go | 4 ++-- go/plugins/vertexai/vertexai.go | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/go/plugins/googleai/embed.go b/go/plugins/googleai/embed.go index 3cfda4386..ecb169be1 100644 --- a/go/plugins/googleai/embed.go +++ b/go/plugins/googleai/embed.go @@ -36,7 +36,7 @@ func (e *embedder) Embed(ctx context.Context, input *ai.EmbedRequest) ([]float32 return res.Embedding.Values, nil } -// NewEmbedder returns an embedder which can compute the embedding +// NewEmbedder returns an [ai.Embedder] that can compute the embedding // of an input document given the Google AI model. func NewEmbedder(ctx context.Context, model, apiKey string) (ai.Embedder, error) { client, err := newClient(ctx, apiKey) diff --git a/go/plugins/googleai/googleai.go b/go/plugins/googleai/googleai.go index 17eea79c1..100677713 100644 --- a/go/plugins/googleai/googleai.go +++ b/go/plugins/googleai/googleai.go @@ -188,7 +188,7 @@ func translateResponse(resp *genai.GenerateContentResponse) *ai.GenerateResponse return r } -// NewGenerator returns an action which sends a request to +// NewGenerator returns an [ai.Generator] which sends a request to // the google AI model and returns the response. func NewGenerator(ctx context.Context, model, apiKey string) (ai.Generator, error) { client, err := newClient(ctx, apiKey) @@ -201,7 +201,7 @@ func NewGenerator(ctx context.Context, model, apiKey string) (ai.Generator, erro }, nil } -// Init registers all the actions in this package with ai. +// Init registers all the actions in this package with [ai]'s Register calls. func Init(ctx context.Context, model, apiKey string) error { e, err := NewEmbedder(ctx, model, apiKey) if err != nil { diff --git a/go/plugins/pinecone/genkit.go b/go/plugins/pinecone/genkit.go index e05e8222f..33a1ba23d 100644 --- a/go/plugins/pinecone/genkit.go +++ b/go/plugins/pinecone/genkit.go @@ -36,7 +36,7 @@ import ( // documents in pinecone. const defaultTextKey = "_content" -// Init registers actions to be used with ai. +// Init registers all the actions in this package with [ai]'s Register calls. // // apiKey is the API key to use to access Pinecone. // If it is the empty string, it is read from the PINECONE_API_INDEX diff --git a/go/plugins/vertexai/embed.go b/go/plugins/vertexai/embed.go index baa15ca80..3ed7522f4 100644 --- a/go/plugins/vertexai/embed.go +++ b/go/plugins/vertexai/embed.go @@ -35,8 +35,8 @@ type embedder struct { client *aiplatform.PredictionClient } -// EmbedOptions is options for the Vertex AI embedder. -// Set [ai.EmbedRequest].Options to a value of type &EmbedOptions. +// EmbedOptions are options for the Vertex AI embedder. +// Set [ai.EmbedRequest.Options] to a value of type &[EmbedOptions]. type EmbedOptions struct { // Document title. Title string `json:"title,omitempty"` diff --git a/go/plugins/vertexai/vertexai.go b/go/plugins/vertexai/vertexai.go index f9e0c1c67..22e2e180a 100644 --- a/go/plugins/vertexai/vertexai.go +++ b/go/plugins/vertexai/vertexai.go @@ -161,7 +161,7 @@ func translateResponse(resp *genai.GenerateContentResponse) *ai.GenerateResponse return r } -// NewGenerator returns an action which sends a request to +// NewGenerator returns an [ai.Generator] which sends a request to // the vertex AI model and returns the response. func NewGenerator(ctx context.Context, model, projectID, location string) (ai.Generator, error) { client, err := newClient(ctx, projectID, location) @@ -174,7 +174,7 @@ func NewGenerator(ctx context.Context, model, projectID, location string) (ai.Ge }, nil } -// Init registers all the actions in this package with ai. +// Init registers all the actions in this package with [ai]'s Register calls. func Init(ctx context.Context, model, projectID, location string) error { g, err := NewGenerator(ctx, model, projectID, location) if err != nil { From 5ccd9fdce2f57d27ef36e535b3e8e8477249837c Mon Sep 17 00:00:00 2001 From: Keith Randall Date: Wed, 29 May 2024 09:27:52 -0700 Subject: [PATCH 2/2] fix EmbedOptions type --- go/plugins/vertexai/embed.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go/plugins/vertexai/embed.go b/go/plugins/vertexai/embed.go index 3ed7522f4..dcdc9eb96 100644 --- a/go/plugins/vertexai/embed.go +++ b/go/plugins/vertexai/embed.go @@ -36,7 +36,7 @@ type embedder struct { } // EmbedOptions are options for the Vertex AI embedder. -// Set [ai.EmbedRequest.Options] to a value of type &[EmbedOptions]. +// Set [ai.EmbedRequest.Options] to a value of type *[EmbedOptions]. type EmbedOptions struct { // Document title. Title string `json:"title,omitempty"`