diff --git a/v2/ollamaclient.go b/v2/ollamaclient.go index aa81db8..6349f65 100644 --- a/v2/ollamaclient.go +++ b/v2/ollamaclient.go @@ -156,8 +156,8 @@ func (oc *Config) SetTool(tool Tool) { oc.Tools = append(oc.Tools, tool) } -// GetOutputChat sends a request to the Ollama API and returns the generated response -func (oc *Config) GetOutputChat(promptAndOptionalImages ...string) (OutputResponse, error) { +// GetChatResponse sends a request to the Ollama API and returns the generated response +func (oc *Config) GetChatResponse(promptAndOptionalImages ...string) (OutputResponse, error) { var ( temperature float64 seed = oc.SeedOrNegative @@ -249,8 +249,8 @@ func (oc *Config) GetOutputChat(promptAndOptionalImages ...string) (OutputRespon return res, nil } -// GetOutputResponse sends a request to the Ollama API and returns the generated response -func (oc *Config) GetOutputResponse(promptAndOptionalImages ...string) (OutputResponse, error) { +// GetResponse sends a request to the Ollama API and returns the generated response +func (oc *Config) GetResponse(promptAndOptionalImages ...string) (OutputResponse, error) { var ( temperature float64 cacheKey string @@ -351,7 +351,7 @@ func (oc *Config) GetOutputResponse(promptAndOptionalImages ...string) (OutputRe // GetOutput sends a request to the Ollama API and returns the generated output string func (oc *Config) GetOutput(promptAndOptionalImages ...string) (string, error) { - resp, err := oc.GetOutputResponse(promptAndOptionalImages...) + resp, err := oc.GetResponse(promptAndOptionalImages...) if err != nil { return "", err } @@ -367,18 +367,18 @@ func (oc *Config) MustOutput(promptAndOptionalImages ...string) string { return output } -// MustOutputResponse returns the response from Ollama, or an error if not -func (oc *Config) MustOutputResponse(promptAndOptionalImages ...string) OutputResponse { - resp, err := oc.GetOutputResponse(promptAndOptionalImages...) +// MustGetResponse returns the response from Ollama, or an error if not +func (oc *Config) MustGetResponse(promptAndOptionalImages ...string) OutputResponse { + resp, err := oc.GetResponse(promptAndOptionalImages...) if err != nil { return OutputResponse{Error: err.Error()} } return resp } -// MustOutputChat returns the response from Ollama, or a response with an error if not -func (oc *Config) MustOutputChat(promptAndOptionalImages ...string) OutputResponse { - output, err := oc.GetOutputChat(promptAndOptionalImages...) +// MustGetChatResponse returns the response from Ollama, or a response with an error if not +func (oc *Config) MustGetChatResponse(promptAndOptionalImages ...string) OutputResponse { + output, err := oc.GetChatResponse(promptAndOptionalImages...) if err != nil { return OutputResponse{Error: err.Error()} } diff --git a/v2/tools_test.go b/v2/tools_test.go index 70c664b..2afb239 100644 --- a/v2/tools_test.go +++ b/v2/tools_test.go @@ -45,33 +45,11 @@ func TestTools(t *testing.T) { } }`), &toolGetCurrentWeather) - // toolGetCurrentWeather := Tool{ - // Type: "function", - // Function: ToolFunction{ - // Name: "get_current_weather", - // Description: "Get the current weather for a location", - // Parameters: ToolParameters{ - // Type: "object", - // Properties: map[string]ToolProperty{ - // "location": { - // Type: "string", - // Description: "The location to get the weather for, e.g. San Francisco, CA", - // }, - // "format": { - // Type: "string", - // Description: "The format to return the weather in, e.g. 'celsius' or 'fahrenheit'", - // Enum: []string{"celsius", "fahrenheit"}, - // }, - // }, - // Required: []string{"location", "format"}, - // }, - // }, - // } - oc.SetTool(toolGetCurrentWeather) - prompt := "What is the weather in Toronto?" - generatedOutput := oc.MustOutputChat(prompt) + const prompt = "What is the weather in Toronto?" + + generatedOutput := oc.MustGetChatResponse(prompt) if generatedOutput.Error != "" { t.Error(generatedOutput.Error) }