|
| 1 | +/* |
| 2 | + * Copyright 2024 Google LLC |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +package com.google.firebase.vertexai.type |
| 18 | + |
| 19 | +/** |
| 20 | + * A declared function that a model can be given access to in order to gain info or complete tasks. |
| 21 | + * |
| 22 | + * ``` |
| 23 | + * val getExchangeRate = FunctionDeclaration( |
| 24 | + * name = "getExchangeRate", |
| 25 | + * description = "Get the exchange rate for currencies between countries.", |
| 26 | + * parameters = mapOf( |
| 27 | + * "currencyFrom" to Schema.str("The currency to convert from."), |
| 28 | + * "currencyTo" to Schema.str("The currency to convert to.") |
| 29 | + * ) |
| 30 | + * ) |
| 31 | + * ``` |
| 32 | + * |
| 33 | + * @param name The name of the function call, this should be clear and descriptive for the model. |
| 34 | + * @param description A description of what the function does and its output. |
| 35 | + * @param parameters A list of parameters that the function accepts. |
| 36 | + * @param optionalParameters A list of parameters that can be omitted. |
| 37 | + * @see Schema |
| 38 | + */ |
| 39 | +class FunctionDeclaration( |
| 40 | + val name: String, |
| 41 | + val description: String, |
| 42 | + val parameters: Map<String, Schema>, |
| 43 | + val optionalParameters: List<String> = emptyList(), |
| 44 | +) |
0 commit comments