Tools in Playground

Using function calling within the Orq.ai Playground

Playground Tools let you use function calling abilities available on models that support it.

Function calling is a way for a model to output structured text automatically. The structured text follows a set of user-defined variables and is formatted in JSON. It can then be used to call any other function or system.

Function calling is a safe way to integrate a model with any external service, with common use-cases like:

  • Answering user queries via external API calls.
  • Converting natural language to a structured function call.
  • Extracting structured data from any text.

Declaring a Tool

You can declare a new function within the Tools panel in the playground by selecting the Add Tool button.

You will be presented with a new function for which you can define name and JSON schema.

Here is an example of a JSON object for a function get_current_weather that declares the fields location (string)and unit (string):

{
  "type": "object",
  "required": [
    "location",
    "unit"
  ],
  "properties": {
    "unit": {
      "type": "string",
      "description": "The temperature unit, e.g. Celsius"
    },
    "location": {
      "type": "string",
      "description": "The city and state, e.g. San Francisco, CA"
    }
  }
}

Using a Tool

Using the previous example, we are able to use a prompt template that Gives the current weather for {{city}}, {{country}}, choose a unit fitting to the location and automatically converts the answer to the desired structured output.

Here we can see the model interpret the User query to format and output the previously defined function.

Here we can see the model interpret the user query to format and output the previously defined function.