GetToolDefinitions returns the tool definitions for OpenAI function calling
()
| 20 | |
| 21 | // GetToolDefinitions returns the tool definitions for OpenAI function calling |
| 22 | func (st *ShoppingTools) GetToolDefinitions() []openai.ChatCompletionToolParam { |
| 23 | return []openai.ChatCompletionToolParam{ |
| 24 | { |
| 25 | Type: "function", |
| 26 | Function: shared.FunctionDefinitionParam{ |
| 27 | Name: "search_products", |
| 28 | Description: param.NewOpt("Search for products by query, category, or price range"), |
| 29 | Parameters: shared.FunctionParameters{ |
| 30 | "type": "object", |
| 31 | "properties": map[string]interface{}{ |
| 32 | "query": map[string]interface{}{ |
| 33 | "type": "string", |
| 34 | "description": "Search query for product name or description", |
| 35 | }, |
| 36 | "category": map[string]interface{}{ |
| 37 | "type": "string", |
| 38 | "description": "Product category (electronics, clothing, books, home, sports, beauty, toys, food)", |
| 39 | }, |
| 40 | "limit": map[string]interface{}{ |
| 41 | "type": "integer", |
| 42 | "description": "Maximum number of results to return (default: 10)", |
| 43 | }, |
| 44 | }, |
| 45 | }, |
| 46 | }, |
| 47 | }, |
| 48 | { |
| 49 | Type: "function", |
| 50 | Function: shared.FunctionDefinitionParam{ |
| 51 | Name: "add_to_cart", |
| 52 | Description: param.NewOpt("Add a product to the shopping cart"), |
| 53 | Parameters: shared.FunctionParameters{ |
| 54 | "type": "object", |
| 55 | "properties": map[string]interface{}{ |
| 56 | "product_name": map[string]interface{}{ |
| 57 | "type": "string", |
| 58 | "description": "The name of the product to add", |
| 59 | }, |
| 60 | "quantity": map[string]interface{}{ |
| 61 | "type": "integer", |
| 62 | "description": "Quantity to add (default: 1)", |
| 63 | }, |
| 64 | }, |
| 65 | "required": []string{"product_name"}, |
| 66 | }, |
| 67 | }, |
| 68 | }, |
| 69 | { |
| 70 | Type: "function", |
| 71 | Function: shared.FunctionDefinitionParam{ |
| 72 | Name: "remove_from_cart", |
| 73 | Description: param.NewOpt("Remove a product from the shopping cart"), |
| 74 | Parameters: shared.FunctionParameters{ |
| 75 | "type": "object", |
| 76 | "properties": map[string]interface{}{ |
| 77 | "product_name": map[string]interface{}{ |
| 78 | "type": "string", |
| 79 | "description": "The name of the product to remove", |