Skip to content

Multi-Function Example

Prompty can use multiple functions in a single prompt.

Refer to the functions.prompty file for more examples.

YAML
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
---
name: Multi-Function Example
description: A prompt that uses multiple functions
authors:
  - example_author
model:
  api: chat
  configuration:
    azure_deployment: gpt-35-turbo
  parameters:
    tools:
    - type: function
      function:
        name: get_current_weather
        description: Get the current weather in a given location
        parameters:
          properties:
            location:
              description: The city and state or city and country, e.g. San Francisco, CA or Tokyo, Japan
              type: string
          required:
          - location
          type: object
    - type: function
      function:
        name: create_a_picture
        description: Creates a picture based on a description given by the user.
        parameters:
          properties:
            prompt:
              description: The description of what the picture should be
              type: string
          required:
          - prompt
          type: object
sample:
  location: "San Francisco, CA"
  prompt: "a drawing of a cat"
---
system:
You are a helpful assistant that uses multiple functions.
user:
Please get the current weather in {{location}} and create a picture based on the following description: {{prompt}}