Documentation ¶
Overview ¶
package palm implements a langchaingo provider for Google Vertex AI legacy PaLM models. Use the newer Gemini models via llms/googleai/vertex if possible.
Index ¶
- Variables
- type LLM
- func (o *LLM) Call(ctx context.Context, prompt string, options ...llms.CallOption) (string, error)
- func (o *LLM) CreateEmbedding(ctx context.Context, inputTexts []string) ([][]float32, error)
- func (o *LLM) GenerateContent(ctx context.Context, messages []llms.MessageContent, ...) (*llms.ContentResponse, error)
- type Option
- func WithAPIKey(apiKey string) Option
- func WithCredentialsFile(path string) Option
- func WithCredentialsJSON(json []byte) Option
- func WithGRPCDialOption(opt grpc.DialOption) Option
- func WithHTTPClient(client *http.Client) Option
- func WithLocation(location string) Option
- func WithProjectID(projectID string) Option
Constants ¶
This section is empty.
Variables ¶
var ( ErrEmptyResponse = errors.New("no response") ErrMissingProjectID = errors.New("missing the GCP Project ID, set it in the GOOGLE_CLOUD_PROJECT environment variable") //nolint:lll ErrMissingLocation = errors.New("missing the GCP Location, set it in the GOOGLE_CLOUD_LOCATION environment variable") //nolint:lll ErrUnexpectedResponseLength = errors.New("unexpected length of response") ErrNotImplemented = errors.New("not implemented") )
Functions ¶
This section is empty.
Types ¶
type LLM ¶
func (*LLM) CreateEmbedding ¶
CreateEmbedding creates embeddings for the given input texts.
func (*LLM) GenerateContent ¶
func (o *LLM) GenerateContent(ctx context.Context, messages []llms.MessageContent, options ...llms.CallOption) (*llms.ContentResponse, error)
GenerateContent implements the Model interface.
type Option ¶
type Option func(*options)
Option is a function that can be passed to NewClient to configure options.
func WithAPIKey ¶
WithAPIKey returns a ClientOption that specifies an API key to be used as the basis for authentication.
func WithCredentialsFile ¶
WithCredentialsFile returns a ClientOption that authenticates API calls with the given service account or refresh token JSON credentials file.
func WithCredentialsJSON ¶
WithCredentialsJSON returns a ClientOption that authenticates API calls with the given service account or refresh token JSON credentials.
func WithGRPCDialOption ¶
func WithGRPCDialOption(opt grpc.DialOption) Option
func WithHTTPClient ¶
func WithLocation ¶ added in v0.1.11
WithLocation passes the Google Cloud location to the client.
func WithProjectID ¶
WithProjectID passes the Google Cloud project ID to the client. If not set, the project is read from the GOOGLE_CLOUD_PROJECT environment variable.