Call Tool

0 views
Skip to first unread message

Perpetuo Carlson

unread,
Aug 5, 2024, 6:21:11 AM8/5/24
to giuglutcornwant
1 on this, I have a use case where I want to call the same tool multiple times, but I want to limit the number of times it can be called, otherwise it can exceed max_tokens and cause a 500 server error!

Smarter campaigns lead to more successful engagements. Simply dialing through a list as quickly as possible will not yield the best engagement on calls. CallTools offers a variety of options to help manage your campaigns for better connections with your customers and prospects. From the start of the first call to your final interaction, the CallTools Power Contact Center was designed to nurture your contacts throughout the process.


Everything starts with the agent experience. Simple enough to get started right away, yet advanced enough to handle all aspects of client interaction. Your agents will provide data that can elevate your campaigns and improve engagement.


Maximize agent productivity at your call center with a solution that manages your calls for success from beginning to end. Better campaigns start with improved contact management, smarter calling lists, redundant redial rules and abundant automations.


Lower the chance of blocked calls with suppression rules designed to alleviate disruptive calling behaviors automatically. Protect your reputation with caller ID auditing, allowing you to swap out bad caller IDs quickly.


If you make a call using the Hubspot calling tool from a company record and then you create a contact, the browser will move away from the company page that had the calling tool open and open the contact that you just created, in turn dropping the call that you were on.


So if you are on the phone with ABC Corporation and the receptionist tells you the name of the decision maker that you should be talking to. If you add that contact to the company record, you will hang up on the receptionist.


Large Language Models (LLMs) can interact with external data sources via tool calling functionality. Tool calling is a powerful technique that allows developers to build sophisticated applications that can leverage LLMs to access, interact and manipulate external resources like databases, files and APIs.


ChatModel.bind_tools provides a standard interface implemented by all tool-calling models that lets you specify which tools are available to the model. You can pass in not just a raw tool definition (a dict), but also objects from which a tool definition can be derived: namely Pydantic classes, LangChain tools, and arbitrary functions. This makes it easy to create generic tool definitions that you can use with any tool-calling model:


We recently released the ChatModel.with_structured_output() interface for getting structured outputs from a model, which is very related. While the exact implementation varies by model provider, with_structured_output is built on top of tool-calling for most models that support it. Under the hood, with_structured_output uses bind_tools to pass the given structured output schema to the model.


with_structured_output always returns a structured output in the schema that you specified. This is useful when you want to force the LLM to output information that matches a specific schema. This is useful for information extraction tasks.


bind_tools is more general and can select a specific tool - or no tool, or multiple tools! This is useful when you want to allow the LLM to have more flexibility in how it should respond - for example, in agent applications where you need to choose which tools to invoke but also respond to the user.


We expect that the trend to introduce native tool calling capabilities into LLMs will continue in the future. We hope that the standardized tool calling interface can help save LangChain users time and effort and allow them to switch between different LLM providers more easily.


The large language model needs to know the tool results before it can continue generating text.This requires sending the tool results back to the model.You can enable this feature by setting the maxToolRoundtrips setting to a number greater than 0.


The Attendance (Roll Call) tool is an external app (LTI) used for taking attendance in Canvas courses. The Attendance tool can be used for online or face-to-face courses. Enabled at the account level, the Roll Call Attendance tool can be used by all courses in the Canvas account.


The Attendance tool always appears as a visible Course Navigation link, but it cannot be viewed by students, so hiding the link in Course Settings is not necessary. If instructors do not want to use the Attendance tool in their courses, no action is required. However, if you do use the Attendance tool, students can view their attendance report through the Roll Call Attendance submission details page.


With the Attendance tool, instructors can keep track of course attendance by taking roll electronically. Instructors can choose to view the tool in a list or grid format and can customize the placement of each student in the seating chart.


By default, the value of being late is 80% of the present value. So if a student is late, the student will receive 80% for the day instead of the full 100%. The late value can be adjusted in Roll Call settings.


In the Gradebook Attendance column, by default Canvas displays the assignment based on percentage of the point value. For instance, if the point value is 100, and roll call has been taken twice, a student with one present value (100%) and one lateness value (calculated at 80%) will have a score of 90 points, or 90%.


Note: Although students cannot view the actual attendance tool, if you are using attendance for grading, they can still view their attendance score in their Grades page and view their attendance report. You can prevent the assignment from triggering notifications by setting a manual posting policy for the assignment.


Remember, while the name "tool calling" implies that the model is directly performing some action, this is actually not the case! The model only generates the arguments to a tool, and actually running the tool (or not) is up to the user.


Tool calling is a general technique that generates structured output from a model, and you can use it even when you don't intend to invoke any tools. An example use-case of that is extraction from unstructured text.


LangChain implements standard interfaces for defining tools, passing them to LLMs, and representing tool calls.This guide will cover how to bind tools to an LLM, then invoke the LLM to generate these arguments.


Chat models that support tool calling features implement a .bind_tools method, whichreceives a list of functions, Pydantic models, or LangChain tool objectsand binds them to the chat model in its expected format. Subsequent invocations of thechat model will include tool schemas in its calls to the LLM.


To actually bind those schemas to a chat model, we'll use the .bind_tools() method. This handles convertingthe Add and Multiply schemas to the proper format for the model. The tool schema will then be passed it in each time the model is invoked.


As we can see our LLM generated arguments to a tool! You can look at the docs for bind_tools() to learn about all the ways to customize how your LLM selects tools, as well as this guide on how to force the LLM to call a tool rather than letting it decide.


The .tool_calls attribute should contain valid tool calls. Note that on occasion,model providers may output malformed tool calls (e.g., arguments that are notvalid JSON). When parsing fails in these cases, instancesof InvalidToolCallare populated in the .invalid_tool_calls attribute. An InvalidToolCall can havea name, string arguments, identifier, and error message.


If desired, output parsers can furtherprocess the output. For example, we can convert existing values populated on the .tool_calls attribute back to the original Pydantic class using thePydanticToolsParser:


Note that when you have tool_choice as any or tool, we will prefill the assistant message to force a tool to be used. This means that the models will not emit a chain-of-thought text content block before tool_use content blocks, even if explicitly asked to do so.


Our testing has shown that this should not reduce performance. If you would like to keep chain-of-thought (particularly with Opus) while still requesting that the model use a specific tool, you can use "type": "auto" for tool_choice (the default) and add explicit instructions in a user message. For example: What's the weather like in London? Use the get_weather tool in your response.


With the Claude 3 Sonnet model, chain of thought is less common by default, but you can prompt Claude to show its reasoning by adding something like "Before answering, explain your reasoning step-by-step in tags." to the user message or system prompt.


Messages contain arrays of text, image, tool_use, and tool_result blocks. user messages include client-side content and tool_result, while assistant messages contain AI-generated content and tool_use.


Some tasks may require calling multiple tools in sequence, using the output of one tool as the input to another. In such a case, Claude will call one tool at a time. If prompted to call the tools all at once, Claude is likely to guess parameters for tools further downstream if they are dependent on tool results for tools further upstream.


By default, Claude 3 Opus is prompted to think before it answers a tool use query to best determine whether a tool is necessary, which tool to use, and the appropriate parameters. Claude 3 Sonnet and Claude 3 Haiku are prompted to try to use tools as much as possible and are more likely to call an unnecessary tool or infer missing parameters. To prompt Sonnet or Haiku to better assess the user query before making tool calls, the following prompt can be used:


Answer the user's request using relevant tools (if they are available). Before calling a tool, do some analysis within \\ tags. First, think about which of the provided tools is the relevant tool to answer the user's request. Second, go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool call. BUT, if one of the values for a required parameter is missing, DO NOT invoke the function (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters. DO NOT ask for more information on optional parameters if it is not provided.

3a8082e126
Reply all
Reply to author
Forward
0 new messages