AI Agent with Multifunction Calling using Google Vertex AI > Using the AI Agent with Multifunction Calling using Google Vertex AI recipe > Step 8. Publish and run the guide
  

Step 8. Publish and run the guide

Configure the Google Vertex AI LLM model version, execution queue count, and process URLs of the processes you want to run, and then publish and run the guide.
  1. 1Open the AI Agent with Multifunction Calling using Google Vertex AI guide.
  2. 2On the Start tab of the Start step, ensure that the Run As field is set to Current User.
  3. 3On the Assignments tab of the Set Flow Configuration step, enter values for the following fields:
    1. aIn the Generation_Config field, enter the prompt instructions using the Expression Editor, as shown in the following sample code:
    2. <generationConfig>
      <temperature>0.2</temperature>
      <maxOutputTokens>1024</maxOutputTokens>
      <topP>0.8</topP>
      </generationConfig>
      For the Generation_Config field, enter values for the following properties:
      Property
      Description
      temperature
      Controls the randomness of the model's output. A lower value close to 0 makes the output more deterministic, while a higher value close to 1 increases randomness and creativity. For example, if temperature is set to 0.5, the model balances between deterministic and creative outputs.
      maxOutputTokens
      Defines the maximum number of tokens that the model can generate in its response. Setting a limit ensures that the response is concise and fits within the desired length constraints.
      topP
      Determines the cumulative probability threshold for token selection. The model considers the smallest set of tokens whose cumulative probability meets or exceeds topP. For example, if topP is set to 0.1, the model considers only the top 10% most probable tokens at each step.
    3. bIn the LLM_Model field, enter the model ID of the LLM model that you want to use. The model ID is set to gemini-1.5-pro-002, by default.
    4. cIn the Execution_Queue_Count field, enter the minimum number of processes to be executed. The number can't be less than 1. The default value is set to 2.
    5. Note: The maximum number of processes is limited by the number of declared functions. If the field value is not set, the default value will be the number of declared functions.
      For example, if you have two processes and two declared functions, but you need to call only one process, set the Execution_Queue_Count field value to 1 and the LLM will define the first declared function that meets the system instruction and the corresponding process will be triggered. If you have two processes and three declared functions and you need to call all the processes, set the Execution_Queue_Count field value to 2, and the LLM will define two processes in order according to the system instruction and the corresponding processes will be triggered.
    6. dIn the Function_Declaration field, access the prompt instruction and replace <Service_URL_of_the_Application_Integration_Process> with the process URLs of the processes that you want to execute using the Expression Editor, as shown in the following sample code:
    7. <tools>
      <functionDeclarations>
      <name>Get_Salesforce_Object</name>
      <description>The function recognizes standard Salesforce objects and ensures they align strictly with Salesforce documentation. Based on the user's query, it constructs accurate filters to isolate relevant data and retrieves the corresponding values for these filters. This process guarantees compliance with Salesforce's data structure and optimizes the query results for precision and relevance.</description>
      <parameters>
      <type>object</type>
      <properties>
      <Process_URL>
      <type>string</type>
      <description>Fixed URL to execute process</description>
      <enum><Service_URL_of_the_Application_Integration_Process></enum>
      </Process_URL>
      <Payload>
      <type>array</type>
      <description>Structured payload for processes</description>
      <items>
      <description>Fields in payload for processes</description>
      <type>object</type>
      <properties>
      <Entity_Type>
      <type>string</type>
      <description>Standard Salesforce objects (e.g., Account, Contact) represent key business information. These built-in data tables provide core CRM functionality.</description>
      </Entity_Type>
      <Filter_Name>
      <type>string</type>
      <description>The field name by which the standard Salesforce objects will be filtered. This field name must match with the corresponding field names defined in Salesforce's documentation to ensure accurate and compliant data filtering.</description>
      </Filter_Name>
      <Filter_Data>
      <type>string</type>
      <description>The value associated with the specified Filter_Name, which is required when Filter_Name is present. This variable filters records for standard Salesforce objects, ensuring precise data selection in line with Salesforce's structure.</description>
      </Filter_Data>
      </properties>
      <required>Entity_Type</required>
      <required>Filter_Name</required>
      <required>Filter_Data</required>
      </items>
      </Payload>
      </properties>
      <required>Process_URL</required>
      <required>Payload</required>
      </parameters>
      </functionDeclarations>
      <functionDeclarations>
      <name>Create_ServiceNow_Object</name>
      <description>This function processes JSON input and is triggered only when a valid JSON structure is provided. It maps fields into a ServiceNow-compatible payload, following the specifications and structure outlined in the ServiceNow documentation. The function extracts relevant data, such as user details or system information, and transforms it into a format that ServiceNow can accept, ensuring proper field mappings and adherence to the required schema conventions.</description>
      <parameters>
      <type>object</type>
      <properties>
      <Process_URL>
      <type>string</type>
      <description>Fixed URL to execute process</description>
      <enum><Service_URL_of_the_Application_Integration_Process></enum>
      </Process_URL>
      <Payload>
      <type>array</type>
      <description>Structured payload for processes</description>
      <items>
      <description>Fields in payload for processes</description>
      <type>object</type>
      <properties>
      <Table_Name>
      <type>string</type>
      <description>Specifies the name of a particular table in the ServiceNow system used for data storage. This variable is used to identify the target table for operations, such as data retrieval, insertion, or modification within the system. For the case table in Salesforce, use the corresponding incident table in ServiceNow, for the account table, use the core_company table, for the contact table, use the sys_user table, for the opportunity table, use the x_mas_opportunity_opportunity table.</description>
      </Table_Name>
      <Object>
      <type>string</type>
      <description>When handling a response, the first step is identifying the key fields required for integration with ServiceNow. For the Case table, map number to number, subject to short_description, contact to u_name, description to description. For the Opportunity table, map stage to isclosed and iswon and define the transformation logic, map amount to amount, name to opportunity_name. For the Contact table, map first_name to first_name, last_name to last_name, email to email, mailing_address to street, mailing_city to city, mailing_state to state, mailing_zip to zip, and set the country field. For the Account table, map name to name, phone to phone, billing_address to street, billing_city to city, billing_state to state, billing_zip to zip, and set the country field. Use only the transformation examples and fields above to transform fields correctly. If the example does not have a field and the prompt does, skip it. After the fields are mapped and converted, the data must be structured into a valid JSON format that meets the ServiceNow API standards. This JSON object must contain all the required fields in the correct structure and format. The result must be a clean, correct JSON object containing only the required data fields, with no additional text, explanations, or extraneous characters.</description>
      </Object>
      </properties>
      <required>Table_Name</required>
      <required>Object</required>
      </items>
      </Payload>
      </properties>
      <required>Process_URL</required>
      <required>Payload</required>
      </parameters>
      </functionDeclarations>
      </tools>
  4. 4Save and publish the guide.
  5. 5On the Actions menu, click Run. Alternatively, you can copy the execution URL from the Properties Details dialog box to run the guide.
  6. 6On the Instructions page, enter the following values:
  7. 7Click Continue.
  8. You will receive a summary of the function call request in response if the function call is generated. Otherwise, an error message appears.
  9. 8Click Confirm to confirm the summary of the function call response and make a call to the CAI process or click Try again.
  10. You will receive a response that contains the process call status, the process execution status, and the process response.
Note: If the process you are calling returns any response, you will see the response on the Answer screen. However, if the process runs for more than 59 seconds, you will see a message about the successful process call, but the result can be viewed in Application Integration Console.
You can also use the embed code to embed the guide into an HTML document of a third-party application.