langchaingo icon indicating copy to clipboard operation
langchaingo copied to clipboard

Examples for Tools usage

Open guidoveritone opened this issue 1 year ago • 3 comments

I have noticed that the use of "functions" is now deprecated and was replaced for "tools".

Will be pretty nice to update the examples dir in the repo adding examples for usage of this, since I just found the functions example

guidoveritone avatar May 28 '24 14:05 guidoveritone

The example https://github.com/tmc/langchaingo/blob/main/examples/googleai-tool-call-example/googleai-tool-call-example.go should show how to use tool calling.

mheers avatar May 30 '24 09:05 mheers

Definitely agree we should have additional tool use examples, please consider contributing new examples!

tmc avatar Jun 15 '24 04:06 tmc

Is there a schema definition for how to define tools?

For example here:

Function: &llms.FunctionDefinition{
	Name:        "getTitlesByTag",
	Description: "Gets available titles associated with a set of tags defined by a tag key and value",
	Parameters: map[string]any{
		"type": "object",
		"properties": map[string]any{
			"key": map[string]any{
				"type":        "string",
				"enum":        []string{"actor", "genre"},
				"description": "The tag key",
			},
			"unit": map[string]any{
				"type": "string",
				"enum": []string{"fahrenheit", "celsius"},
			},
		},
		"required": []string{"location"},
	},
},

What are the valid types of parameters.type? Or properties? It would be great to add in some more clear typing/enum here. I can submit a PR if I can find the definitions.

kristian1108 avatar Sep 15 '24 19:09 kristian1108