From 75ee21080d8a95ff6b38737b333bab40eaf64996 Mon Sep 17 00:00:00 2001 From: Eli Bendersky Date: Wed, 17 Jan 2024 07:24:56 -0800 Subject: [PATCH] llms: clean up comments --- llms/generatecontent.go | 6 ++++-- llms/llms.go | 22 +++++++++++----------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/llms/generatecontent.go b/llms/generatecontent.go index 894da7a23..8d91c2003 100644 --- a/llms/generatecontent.go +++ b/llms/generatecontent.go @@ -62,13 +62,15 @@ type BinaryContent struct { func (BinaryContent) isPart() {} // ContentResponse is the response returned by a GenerateContent call. -// It can potentially return multiple response choices. +// It can potentially return multiple content choices. type ContentResponse struct { Choices []*ContentChoice } -// ContentChoice is one of the response choices returned by GenerateModel calls. +// ContentChoice is one of the response choices returned by GenerateContent +// calls. type ContentChoice struct { + // Content is the textual content of a response Content string // StopReason is the reason the model stopped generating output. diff --git a/llms/llms.go b/llms/llms.go index 33f1b0220..8325d84b2 100644 --- a/llms/llms.go +++ b/llms/llms.go @@ -9,23 +9,23 @@ import ( // LLM is an alias for model, for backwards compatibility. // -// This alias may be removed in the future; please use Model instead. +// This alias may be removed in the future; please use Model +// instead. type LLM = Model // Model is an interface multi-modal models implement. -// Note: this is an experimental API. type Model interface { - // Call is a simplified interface for Model, generating a single string - // response from a single string prompt. - // - // It is here for backwards compatibility only and may be removed in the - // future; please use GenerateContent instead. - Call(ctx context.Context, prompt string, options ...CallOption) (string, error) - // GenerateContent asks the model to generate content from a sequence of - // messages. It's the most general interface for LLMs that support chat-like - // interactions. + // messages. It's the most general interface for multi-modal LLMs that support + // chat-like interactions. GenerateContent(ctx context.Context, messages []MessageContent, options ...CallOption) (*ContentResponse, error) + + // Call is a simplified interface for a text-only Model, generating a single + // string response from a single string prompt. + // + // It is here for backwards compatibility only and may be removed + // in the future; please use GenerateContent instead. + Call(ctx context.Context, prompt string, options ...CallOption) (string, error) } // CallLLM is a helper function for implementing Call in terms of