@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
291 lines • 11.6 kB
JavaScript
;
// *** 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.Example = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
* An example represents a sample conversation between the user and the agent(s).
*
* ## Example Usage
*
* ### Ces Example Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* import * as std from "@pulumi/std";
*
* const my_app = new gcp.ces.App("my-app", {
* location: "us",
* displayName: "my-app",
* appId: "app-id",
* timeZoneSettings: {
* timeZone: "America/Los_Angeles",
* },
* });
* const cesTool = new gcp.ces.Tool("ces_tool", {
* location: "us",
* app: my_app.appId,
* toolId: "tool-1",
* executionType: "SYNCHRONOUS",
* pythonFunction: {
* name: "example_function",
* pythonCode: "def example_function() -> int: return 0",
* },
* });
* const cesToolset = new gcp.ces.Toolset("ces_toolset", {
* toolsetId: "toolset-id",
* location: "us",
* app: my_app.appId,
* displayName: "Basic toolset display name",
* openApiToolset: {
* openApiSchema: `openapi: 3.0.0
* info:
* title: My Sample API
* version: 1.0.0
* description: A simple API example
* servers:
* - url: https://api.example.com/v1
* paths: {}
* `,
* ignoreUnknownFields: false,
* tlsConfig: {
* caCerts: [{
* displayName: "example",
* cert: "ZXhhbXBsZQ==",
* }],
* },
* serviceDirectoryConfig: {
* service: "projects/example/locations/us/namespaces/namespace/services/service",
* },
* apiAuthentication: {
* serviceAgentIdTokenAuthConfig: {},
* },
* },
* });
* const cesBaseAgent = new gcp.ces.Agent("ces_base_agent", {
* agentId: "base-agent-id",
* location: "us",
* app: my_app.appId,
* displayName: "base agent",
* instruction: "You are a helpful assistant for this example.",
* modelSettings: {
* model: "gemini-3.0-flash-001",
* temperature: 0.5,
* },
* llmAgent: {},
* });
* const cesChildAgent = new gcp.ces.Agent("ces_child_agent", {
* agentId: "child-agent-id",
* location: "us",
* app: my_app.appId,
* displayName: "child agent",
* instruction: "You are a helpful assistant for this example.",
* modelSettings: {
* model: "gemini-3.0-flash-001",
* temperature: 0.5,
* },
* llmAgent: {},
* });
* const my_example = new gcp.ces.Example("my-example", {
* location: "us",
* displayName: "my-example",
* app: my_app.name,
* exampleId: "example-id",
* description: "example description",
* entryAgent: pulumi.all([my_app.project, my_app.appId, cesBaseAgent.agentId]).apply(([project, appId, agentId]) => `projects/${project}/locations/us/apps/${appId}/agents/${agentId}`),
* messages: [{
* chunks: [
* {
* agentTransfer: {
* targetAgent: pulumi.all([my_app.project, my_app.appId, cesChildAgent.agentId]).apply(([project, appId, agentId]) => `projects/${project}/locations/us/apps/${appId}/agents/${agentId}`),
* },
* },
* {
* image: {
* mimeType: "image/png",
* data: std.base64encode({
* input: "This is some fake image binary data.",
* }).then(invoke => invoke.result),
* },
* },
* {
* text: "text_data",
* },
* {
* toolCall: {
* args: JSON.stringify({
* arg1: "val1",
* arg2: "val2",
* }),
* id: "tool_call_id",
* tool: pulumi.interpolate`projects/${my_app.project}/locations/us/apps/${my_app.appId}/tools/${cesTool.toolId}`,
* },
* },
* {
* toolCall: {
* args: JSON.stringify({
* arg1: "val1",
* arg2: "val2",
* }),
* id: "tool_call_id2",
* toolsetTool: {
* toolset: pulumi.interpolate`projects/${my_app.project}/locations/us/apps/${my_app.appId}/toolsets/${cesToolset.toolsetId}`,
* toolId: "example-id",
* },
* },
* },
* {
* toolResponse: {
* id: "tool_call_id",
* response: JSON.stringify({
* output: "example-output",
* }),
* tool: pulumi.interpolate`projects/${my_app.project}/locations/us/apps/${my_app.appId}/tools/${cesTool.toolId}`,
* },
* },
* {
* toolResponse: {
* id: "tool_call_id2",
* response: JSON.stringify({
* output: "example-output",
* }),
* toolsetTool: {
* toolset: pulumi.interpolate`projects/${my_app.project}/locations/us/apps/${my_app.appId}/toolsets/${cesToolset.toolsetId}`,
* toolId: "example-id",
* },
* },
* },
* {
* updatedVariables: JSON.stringify({
* var1: "val1",
* var2: "val2",
* }),
* },
* ],
* role: "agent",
* }],
* });
* ```
*
* ## Import
*
* Example can be imported using any of these accepted formats:
*
* * `projects/{{project}}/locations/{{location}}/apps/{{app}}/examples/{{name}}`
* * `{{project}}/{{location}}/{{app}}/{{name}}`
* * `{{location}}/{{app}}/{{name}}`
*
* When using the `pulumi import` command, Example can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:ces/example:Example default projects/{{project}}/locations/{{location}}/apps/{{app}}/examples/{{name}}
* $ pulumi import gcp:ces/example:Example default {{project}}/{{location}}/{{app}}/{{name}}
* $ pulumi import gcp:ces/example:Example default {{location}}/{{app}}/{{name}}
* ```
*/
class Example extends pulumi.CustomResource {
/**
* Get an existing Example 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 Example(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'gcp:ces/example:Example';
/**
* Returns true if the given object is an instance of Example. 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'] === Example.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["app"] = state?.app;
resourceInputs["createTime"] = state?.createTime;
resourceInputs["deletionPolicy"] = state?.deletionPolicy;
resourceInputs["description"] = state?.description;
resourceInputs["displayName"] = state?.displayName;
resourceInputs["entryAgent"] = state?.entryAgent;
resourceInputs["etag"] = state?.etag;
resourceInputs["exampleId"] = state?.exampleId;
resourceInputs["invalid"] = state?.invalid;
resourceInputs["location"] = state?.location;
resourceInputs["messages"] = state?.messages;
resourceInputs["name"] = state?.name;
resourceInputs["project"] = state?.project;
resourceInputs["updateTime"] = state?.updateTime;
}
else {
const args = argsOrState;
if (args?.app === undefined && !opts.urn) {
throw new Error("Missing required property 'app'");
}
if (args?.displayName === undefined && !opts.urn) {
throw new Error("Missing required property 'displayName'");
}
if (args?.exampleId === undefined && !opts.urn) {
throw new Error("Missing required property 'exampleId'");
}
if (args?.location === undefined && !opts.urn) {
throw new Error("Missing required property 'location'");
}
resourceInputs["app"] = args?.app;
resourceInputs["deletionPolicy"] = args?.deletionPolicy;
resourceInputs["description"] = args?.description;
resourceInputs["displayName"] = args?.displayName;
resourceInputs["entryAgent"] = args?.entryAgent;
resourceInputs["exampleId"] = args?.exampleId;
resourceInputs["location"] = args?.location;
resourceInputs["messages"] = args?.messages;
resourceInputs["project"] = args?.project;
resourceInputs["createTime"] = undefined /*out*/;
resourceInputs["etag"] = undefined /*out*/;
resourceInputs["invalid"] = undefined /*out*/;
resourceInputs["name"] = undefined /*out*/;
resourceInputs["updateTime"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Example.__pulumiType, name, resourceInputs, opts);
}
}
exports.Example = Example;
//# sourceMappingURL=example.js.map