UNPKG

@pulumi/gcp

Version:

A Pulumi package for creating and managing Google Cloud Platform resources.

270 lines • 10.1 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.CxPlaybook = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(require("../utilities")); /** * Playbook is the basic building block to instruct the LLM how to execute a certain task. * * To get more information about Playbook, see: * * * [API documentation](https://cloud.google.com/dialogflow/cx/docs/reference/rest/v3/projects.locations.agents.playbooks) * * How-to Guides * * [Official CX Documentation](https://cloud.google.com/dialogflow/cx/docs) * * ## Example Usage * * ### Dialogflowcx Playbook Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const agent = new gcp.diagflow.CxAgent("agent", { * displayName: "dialogflowcx-agent-basic", * location: "global", * defaultLanguageCode: "en", * timeZone: "America/New_York", * description: "Example description.", * }); * const my_playbook = new gcp.diagflow.CxPlaybook("my-playbook", { * parent: agent.id, * displayName: "Example Display Name", * goal: "Example Goal", * playbookType: "ROUTINE", * instruction: { * steps: [ * { * text: "step 1", * steps: JSON.stringify([ * { * text: "step 1 1", * }, * { * text: "step 1 2", * steps: [ * { * text: "step 1 2 1", * }, * { * text: "step 1 2 2", * }, * ], * }, * { * text: "step 1 3", * }, * ]), * }, * { * text: "step 2", * }, * { * text: "step 3", * }, * ], * }, * }); * ``` * ### Dialogflowcx Playbook Fulfillment * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const agent = new gcp.diagflow.CxAgent("agent", { * displayName: "dialogflowcx-agent", * location: "global", * defaultLanguageCode: "en", * timeZone: "America/New_York", * description: "Example description.", * }); * const bucket = new gcp.storage.Bucket("bucket", { * name: "dialogflowcx-bucket", * location: "US", * uniformBucketLevelAccess: true, * }); * const myWebhook = new gcp.diagflow.CxWebhook("my_webhook", { * parent: agent.id, * displayName: "MyWebhook", * genericWebService: { * uri: "https://example.com", * }, * }); * const myTool = new gcp.diagflow.CxTool("my_tool", { * parent: agent.id, * displayName: "Example Tool", * description: "Example Description", * }); * const myGenerator = new gcp.diagflow.CxGenerator("my_generator", { * parent: agent.id, * displayName: "TF Prompt generator", * llmModelSettings: { * model: "gemini-2.0-flash-001", * promptText: "Return me some great results", * }, * promptText: { * text: "Send me great results in french", * }, * modelParameter: { * temperature: 0.55, * }, * }); * const my_playbook = new gcp.diagflow.CxPlaybook("my-playbook", { * parent: agent.id, * displayName: "Playbook Example with Fulfillment", * goal: "Example Goal", * instruction: { * guidelines: "Example Guidelines", * steps: [ * { * text: "step 1", * steps: JSON.stringify([ * { * text: "step 1 1", * }, * { * text: "step 1 2", * steps: [ * { * text: "step 1 2 1", * }, * { * text: "step 1 2 2", * }, * ], * }, * { * text: "step 1 3", * }, * ]), * }, * { * text: "step 2", * }, * { * text: "step 3", * }, * ], * }, * llmModelSettings: { * model: "gemini-2.0-flash-001", * promptText: "Return me some great results", * }, * referencedTools: [myTool.id], * }); * ``` * * ## Import * * Playbook can be imported using any of these accepted formats: * * * `{{parent}}/playbooks/{{name}}` * * `{{parent}}/{{name}}` * * When using the `pulumi import` command, Playbook can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:diagflow/cxPlaybook:CxPlaybook default {{parent}}/playbooks/{{name}} * $ pulumi import gcp:diagflow/cxPlaybook:CxPlaybook default {{parent}}/{{name}} * ``` */ class CxPlaybook extends pulumi.CustomResource { /** * Get an existing CxPlaybook resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name, id, state, opts) { return new CxPlaybook(name, state, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'gcp:diagflow/cxPlaybook:CxPlaybook'; /** * Returns true if the given object is an instance of CxPlaybook. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === CxPlaybook.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["createTime"] = state?.createTime; resourceInputs["deletionPolicy"] = state?.deletionPolicy; resourceInputs["displayName"] = state?.displayName; resourceInputs["goal"] = state?.goal; resourceInputs["instruction"] = state?.instruction; resourceInputs["llmModelSettings"] = state?.llmModelSettings; resourceInputs["name"] = state?.name; resourceInputs["parent"] = state?.parent; resourceInputs["playbookType"] = state?.playbookType; resourceInputs["referencedFlows"] = state?.referencedFlows; resourceInputs["referencedPlaybooks"] = state?.referencedPlaybooks; resourceInputs["referencedTools"] = state?.referencedTools; resourceInputs["tokenCount"] = state?.tokenCount; resourceInputs["updateTime"] = state?.updateTime; } else { const args = argsOrState; if (args?.displayName === undefined && !opts.urn) { throw new Error("Missing required property 'displayName'"); } if (args?.goal === undefined && !opts.urn) { throw new Error("Missing required property 'goal'"); } resourceInputs["deletionPolicy"] = args?.deletionPolicy; resourceInputs["displayName"] = args?.displayName; resourceInputs["goal"] = args?.goal; resourceInputs["instruction"] = args?.instruction; resourceInputs["llmModelSettings"] = args?.llmModelSettings; resourceInputs["parent"] = args?.parent; resourceInputs["playbookType"] = args?.playbookType; resourceInputs["referencedTools"] = args?.referencedTools; resourceInputs["createTime"] = undefined /*out*/; resourceInputs["name"] = undefined /*out*/; resourceInputs["referencedFlows"] = undefined /*out*/; resourceInputs["referencedPlaybooks"] = undefined /*out*/; resourceInputs["tokenCount"] = undefined /*out*/; resourceInputs["updateTime"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(CxPlaybook.__pulumiType, name, resourceInputs, opts); } } exports.CxPlaybook = CxPlaybook; //# sourceMappingURL=cxPlaybook.js.map