UNPKG

@pulumi/gcp

Version:

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

935 lines • 36.7 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * Customer Engagement Suite Evaluation * * > **Warning:** This resource is in beta, and should be used with the terraform-provider-google-beta provider. * See Provider Versions for more details on beta resources. * * To get more information about Evaluation, see: * * * [API documentation](https://docs.cloud.google.com/customer-engagement-ai/conversational-agents/ps/reference/rest/v1beta/projects.locations.apps.evaluations) * * ## Example Usage * * ### Ces Evaluation Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const app = new gcp.ces.App("app", { * appId: "app-id", * location: "us", * displayName: "my-app", * languageSettings: { * defaultLanguageCode: "en-US", * }, * timeZoneSettings: { * timeZone: "America/Los_Angeles", * }, * }); * const cesEvaluationBasic = new gcp.ces.Evaluation("ces_evaluation_basic", { * evaluationId: "eval-basic", * displayName: "my-evaluation-basic", * location: "us", * app: app.appId, * }); * ``` * ### Ces Evaluation Full * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const app = new gcp.ces.App("app", { * appId: "app-id-full", * location: "us", * displayName: "my-app-full", * languageSettings: { * defaultLanguageCode: "en-US", * }, * timeZoneSettings: { * timeZone: "America/Los_Angeles", * }, * }); * const tool = new gcp.ces.Tool("tool", { * location: "us", * app: app.appId, * toolId: "tool-id-full", * executionType: "SYNCHRONOUS", * pythonFunction: { * name: "example_function", * pythonCode: "def example_function() -> int: return 0", * }, * }); * const cesEvaluationFull = new gcp.ces.Evaluation("ces_evaluation_full", { * evaluationId: "evaluation-id-full", * displayName: "my-evaluation-full", * location: "us", * app: app.appId, * description: "Full evaluation for testing", * tags: [ * "test", * "full", * ], * golden: { * evaluationExpectations: [pulumi.interpolate`projects/${app.project}/locations/us/apps/${app.appId}/evaluationExpectations/dummy-exp`], * turns: [{ * steps: [ * { * userInput: { * text: "Hello", * willContinue: true, * }, * }, * { * userInput: { * variables: { * key: "value", * }, * }, * }, * { * expectation: { * note: "Expect tool call", * toolCall: { * id: "tool-call-id", * tool: pulumi.interpolate`projects/${app.project}/locations/us/apps/${app.appId}/tools/${tool.toolId}`, * args: { * param: "value", * }, * }, * }, * }, * { * expectation: { * note: "Expect agent response", * agentResponse: { * role: "agent", * chunks: [ * { * updatedVariables: { * key: "value", * }, * }, * { * agentTransfer: { * targetAgent: pulumi.interpolate`projects/${app.project}/locations/us/apps/${app.appId}/agents/dummy-agent`, * }, * }, * { * toolCall: { * id: "tool-call-id-3", * tool: pulumi.interpolate`projects/${app.project}/locations/us/apps/${app.appId}/tools/${tool.toolId}`, * }, * }, * { * toolResponse: { * id: "tool-call-id-3", * response: { * result: "success", * }, * tool: pulumi.interpolate`projects/${app.project}/locations/us/apps/${app.appId}/tools/${tool.toolId}`, * }, * }, * ], * }, * }, * }, * { * expectation: { * note: "Expect toolset tool call", * toolCall: { * id: "tool-call-id-2", * toolsetTool: { * toolset: pulumi.interpolate`projects/${app.project}/locations/us/apps/${app.appId}/toolsets/dummy-toolset`, * toolId: "dummy-tool", * }, * }, * }, * }, * { * agentTransfer: { * targetAgent: pulumi.interpolate`projects/${app.project}/locations/us/apps/${app.appId}/agents/dummy-agent`, * }, * }, * { * expectation: { * agentTransfer: { * targetAgent: pulumi.interpolate`projects/${app.project}/locations/us/apps/${app.appId}/agents/dummy-agent`, * displayName: "dummy-agent", * }, * }, * }, * { * expectation: { * note: "Expect mock tool response", * mockToolResponse: { * id: "tool-call-id-4", * response: { * result: "mocked", * }, * tool: pulumi.interpolate`projects/${app.project}/locations/us/apps/${app.appId}/tools/${tool.toolId}`, * }, * }, * }, * { * expectation: { * note: "Expect tool response", * toolResponse: { * toolsetTool: { * toolset: pulumi.interpolate`projects/${app.project}/locations/us/apps/${app.appId}/toolsets/dummy-toolset`, * toolId: "dummy-tool", * }, * }, * }, * }, * { * expectation: { * note: "Expect updated variables", * updatedVariables: { * notes: "Some notes", * }, * }, * }, * { * userInput: { * toolResponses: { * toolResponses: [{ * id: "tool-call-id-5", * response: { * result: "user-provided", * }, * tool: pulumi.interpolate`projects/${app.project}/locations/us/apps/${app.appId}/tools/${tool.toolId}`, * }], * }, * }, * }, * { * userInput: { * event: { * event: "my-event", * }, * }, * }, * { * userInput: { * dtmf: "1234", * }, * }, * { * userInput: { * audio: "c29tZSBhdWRpbyBkYXRh", * }, * }, * { * userInput: { * blob: { * mimeType: "text/plain", * data: "c29tZSBibG9iIGRhdGE=", * }, * }, * }, * { * userInput: { * image: { * mimeType: "image/png", * data: "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAAAAAA6fptVAAAACklEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII=", * }, * }, * }, * { * userInput: { * toolResponses: { * toolResponses: [{ * id: "tool-call-id", * response: { * result: "success", * }, * tool: pulumi.interpolate`projects/${app.project}/locations/us/apps/${app.appId}/tools/${tool.toolId}`, * }], * }, * }, * }, * { * expectation: { * note: "Expect tool response", * toolResponse: { * id: "tool-call-id", * response: { * result: "success", * }, * tool: pulumi.interpolate`projects/${app.project}/locations/us/apps/${app.appId}/tools/${tool.toolId}`, * }, * }, * }, * { * expectation: { * note: "Expect agent response with chunks", * agentResponse: { * role: "agent", * chunks: [ * { * text: "Hello again", * }, * { * text: "Hello again transcript", * }, * { * blob: { * mimeType: "text/plain", * data: "c29tZSBibG9iIGRhdGE=", * }, * }, * { * image: { * mimeType: "image/png", * data: "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAAAAAA6fptVAAAACklEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII=", * }, * }, * { * toolCall: { * id: "tool-call-id-3", * tool: pulumi.interpolate`projects/${app.project}/locations/us/apps/${app.appId}/tools/${tool.toolId}`, * args: { * param: "value", * }, * }, * }, * ], * }, * }, * }, * ], * }], * }, * }); * ``` * ### Ces Evaluation Toolset * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const app = new gcp.ces.App("app", { * appId: "app-id-toolset", * location: "us", * displayName: "my-app-toolset", * languageSettings: { * defaultLanguageCode: "en-US", * }, * timeZoneSettings: { * timeZone: "America/Los_Angeles", * }, * }); * const cesEvaluationToolset = new gcp.ces.Evaluation("ces_evaluation_toolset", { * evaluationId: "eval-toolset", * displayName: "my-evaluation-toolset", * location: "us", * app: app.appId, * golden: { * turns: [{ * steps: [ * { * expectation: { * note: "Expect agent response with toolset tool call", * agentResponse: { * role: "agent", * chunks: [{ * toolCall: { * id: "tool-call-id", * toolsetTool: { * toolset: pulumi.interpolate`projects/${app.project}/locations/us/apps/${app.appId}/toolsets/dummy-toolset`, * toolId: "dummy-tool", * }, * }, * }], * }, * }, * }, * { * expectation: { * note: "Expect agent response with toolset tool response", * agentResponse: { * role: "agent", * chunks: [{ * toolResponse: { * id: "tool-call-id", * response: { * result: "success", * }, * toolsetTool: { * toolset: pulumi.interpolate`projects/${app.project}/locations/us/apps/${app.appId}/toolsets/dummy-toolset`, * toolId: "dummy-tool", * }, * }, * }], * }, * }, * }, * { * expectation: { * note: "Expect mock tool response with toolset tool", * mockToolResponse: { * id: "tool-call-id-2", * response: { * result: "mocked", * }, * toolsetTool: { * toolset: pulumi.interpolate`projects/${app.project}/locations/us/apps/${app.appId}/toolsets/dummy-toolset`, * toolId: "dummy-tool", * }, * }, * }, * }, * { * userInput: { * toolResponses: { * toolResponses: [{ * id: "tool-call-id-3", * response: { * result: "user-provided", * }, * toolsetTool: { * toolset: pulumi.interpolate`projects/${app.project}/locations/us/apps/${app.appId}/toolsets/dummy-toolset`, * toolId: "dummy-tool", * }, * }], * }, * }, * }, * ], * }], * }, * }); * ``` * ### Ces Evaluation Scenario Full * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const app = new gcp.ces.App("app", { * appId: "app-id-scenario", * location: "us", * displayName: "my-app-scenario", * languageSettings: { * defaultLanguageCode: "en-US", * }, * timeZoneSettings: { * timeZone: "America/Los_Angeles", * }, * }); * const tool = new gcp.ces.Tool("tool", { * location: "us", * app: app.appId, * toolId: "tool-id-scenario", * executionType: "SYNCHRONOUS", * pythonFunction: { * name: "example_function", * pythonCode: "def example_function() -> int: return 0", * }, * }); * const cesEvaluationScenarioFull = new gcp.ces.Evaluation("ces_evaluation_scenario_full", { * evaluationId: "eval-scenario-full", * displayName: "my-evaluation-scenario-full", * location: "us", * app: app.appId, * description: "Full evaluation for testing scenario", * tags: [ * "test", * "full", * "scenario", * ], * scenario: { * task: "Test task", * maxTurns: 5, * rubrics: [pulumi.interpolate`projects/${app.project}/locations/us/apps/${app.appId}/rubrics/dummy-rubric`], * userGoalBehavior: "USER_GOAL_SATISFIED", * taskCompletionBehavior: "TASK_SATISFIED", * variableOverrides: { * key: "value", * }, * evaluationExpectations: [pulumi.interpolate`projects/${app.project}/locations/us/apps/${app.appId}/evaluationExpectations/dummy-exp`], * userFacts: [{ * name: "user_name", * value: "John Doe", * }], * scenarioExpectations: [ * { * toolExpectation: { * expectedToolCall: { * id: "tool-call-id", * tool: pulumi.interpolate`projects/${app.project}/locations/us/apps/${app.appId}/tools/${tool.toolId}`, * args: { * param: "value", * }, * }, * mockToolResponse: { * id: "tool-call-id", * response: { * result: "mocked", * }, * tool: pulumi.interpolate`projects/${app.project}/locations/us/apps/${app.appId}/tools/${tool.toolId}`, * }, * }, * }, * { * agentResponse: { * role: "agent", * chunks: [ * { * text: "Hello", * }, * { * updatedVariables: { * key: "value", * }, * }, * { * blob: { * mimeType: "text/plain", * data: "c29tZSBibG9iIGRhdGE=", * }, * }, * { * image: { * mimeType: "image/png", * data: "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAAAAAA6fptVAAAACklEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII=", * }, * }, * { * toolCall: { * id: "tool-call-id-3", * tool: pulumi.interpolate`projects/${app.project}/locations/us/apps/${app.appId}/tools/${tool.toolId}`, * args: { * param: "value", * }, * }, * }, * { * toolResponse: { * id: "tool-call-id-3", * response: { * result: "success", * }, * tool: pulumi.interpolate`projects/${app.project}/locations/us/apps/${app.appId}/tools/${tool.toolId}`, * }, * }, * { * agentTransfer: { * targetAgent: pulumi.interpolate`projects/${app.project}/locations/us/apps/${app.appId}/agents/dummy-agent`, * }, * }, * ], * }, * }, * ], * }, * }); * ``` * ### Ces Evaluation Scenario Toolset * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const app = new gcp.ces.App("app", { * appId: "app-id-scenario-ts", * location: "us", * displayName: "my-app-scenario-ts", * languageSettings: { * defaultLanguageCode: "en-US", * }, * timeZoneSettings: { * timeZone: "America/Los_Angeles", * }, * }); * const toolset = new gcp.ces.Toolset("toolset", { * toolsetId: "ts-scen", * location: "us", * app: app.appId, * displayName: "Basic toolset display name", * description: "Test description", * executionType: "SYNCHRONOUS", * 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, * }, * }); * const cesEvaluationScenarioToolset = new gcp.ces.Evaluation("ces_evaluation_scenario_toolset", { * evaluationId: "eval-scen-ts", * displayName: "my-evaluation-scenario-toolset", * location: "us", * app: app.appId, * description: "Full evaluation for testing scenario with toolset", * tags: [ * "test", * "full", * "scenario", * "toolset", * ], * scenario: { * task: "Test task", * maxTurns: 5, * rubrics: [pulumi.interpolate`projects/${app.project}/locations/us/apps/${app.appId}/rubrics/dummy-rubric`], * userGoalBehavior: "USER_GOAL_SATISFIED", * taskCompletionBehavior: "TASK_SATISFIED", * variableOverrides: { * key: "value", * }, * evaluationExpectations: [pulumi.interpolate`projects/${app.project}/locations/us/apps/${app.appId}/evaluationExpectations/dummy-exp`], * userFacts: [{ * name: "user_name", * value: "John Doe", * }], * scenarioExpectations: [ * { * toolExpectation: { * expectedToolCall: { * id: "tool-call-id", * toolsetTool: { * toolset: pulumi.interpolate`projects/${app.project}/locations/us/apps/${app.appId}/toolsets/${toolset.toolsetId}`, * toolId: "dummy-tool", * }, * args: { * param: "value", * }, * }, * mockToolResponse: { * id: "tool-call-id", * response: { * result: "mocked", * }, * toolsetTool: { * toolset: pulumi.interpolate`projects/${app.project}/locations/us/apps/${app.appId}/toolsets/${toolset.toolsetId}`, * toolId: "dummy-tool", * }, * }, * }, * }, * { * agentResponse: { * role: "agent", * chunks: [ * { * text: "Hello", * }, * { * toolCall: { * id: "tool-call-id-3", * toolsetTool: { * toolset: pulumi.interpolate`projects/${app.project}/locations/us/apps/${app.appId}/toolsets/${toolset.toolsetId}`, * toolId: "dummy-tool", * }, * args: { * param: "value", * }, * }, * }, * { * toolResponse: { * id: "tool-call-id-3", * response: { * result: "success", * }, * toolsetTool: { * toolset: pulumi.interpolate`projects/${app.project}/locations/us/apps/${app.appId}/toolsets/${toolset.toolsetId}`, * toolId: "dummy-tool", * }, * }, * }, * ], * }, * }, * ], * }, * }); * ``` * * ## Import * * Evaluation can be imported using any of these accepted formats: * * * `projects/{{project}}/locations/{{location}}/apps/{{app}}/evaluations/{{evaluation_id}}` * * `{{project}}/{{location}}/{{app}}/{{evaluation_id}}` * * `{{location}}/{{app}}/{{evaluation_id}}` * * When using the `pulumi import` command, Evaluation can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:ces/evaluation:Evaluation default projects/{{project}}/locations/{{location}}/apps/{{app}}/evaluations/{{evaluation_id}} * $ pulumi import gcp:ces/evaluation:Evaluation default {{project}}/{{location}}/{{app}}/{{evaluation_id}} * $ pulumi import gcp:ces/evaluation:Evaluation default {{location}}/{{app}}/{{evaluation_id}} * ``` */ export declare class Evaluation extends pulumi.CustomResource { /** * Get an existing Evaluation 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: string, id: pulumi.Input<pulumi.ID>, state?: EvaluationState, opts?: pulumi.CustomResourceOptions): Evaluation; /** * Returns true if the given object is an instance of Evaluation. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is Evaluation; /** * (Required) */ readonly app: pulumi.Output<string>; /** * Timestamp when the evaluation was created. */ readonly createTime: pulumi.Output<string>; /** * The user who created the evaluation. */ readonly createdBy: pulumi.Output<string>; /** * Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. * When a 'terraform destroy' or 'pulumi up' would delete the resource, * the command will fail if this field is set to "PREVENT" in Terraform state. * When set to "ABANDON", the command will remove the resource from Terraform * management without updating or deleting the resource in the API. * When set to "DELETE", deleting the resource is allowed. */ readonly deletionPolicy: pulumi.Output<string>; /** * User-defined description of the evaluation. */ readonly description: pulumi.Output<string | undefined>; /** * User-defined display name of the evaluation. */ readonly displayName: pulumi.Output<string>; /** * Etag used to ensure the object hasn't changed during a read-modify-write operation. */ readonly etag: pulumi.Output<string>; /** * List of evaluation datasets the evaluation belongs to. */ readonly evaluationDatasets: pulumi.Output<string[]>; /** * The ID to use for the evaluation, which will become the final component of * the evaluation's resource name. If not provided, a unique ID will be * automatically assigned for the evaluation. */ readonly evaluationId: pulumi.Output<string>; /** * The evaluation runs for this evaluation. */ readonly evaluationRuns: pulumi.Output<string[]>; /** * Golden input. * Structure is documented below. */ readonly golden: pulumi.Output<outputs.ces.EvaluationGolden | undefined>; /** * Whether the evaluation is invalid. */ readonly invalid: pulumi.Output<boolean>; /** * The user who last updated the evaluation. */ readonly lastUpdatedBy: pulumi.Output<string>; /** * (Required) */ readonly location: pulumi.Output<string>; /** * Identifier. The unique identifier of the evaluation. * Format: `projects/{project}/locations/{location}/apps/{app}/evaluations/{evaluation}` */ readonly name: pulumi.Output<string>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ readonly project: pulumi.Output<string>; /** * Scenario input. * Structure is documented below. */ readonly scenario: pulumi.Output<outputs.ces.EvaluationScenario | undefined>; /** * User defined tags to categorize the evaluation. */ readonly tags: pulumi.Output<string[] | undefined>; /** * Timestamp when the evaluation was last updated. */ readonly updateTime: pulumi.Output<string>; /** * Create a Evaluation resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: EvaluationArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering Evaluation resources. */ export interface EvaluationState { /** * (Required) */ app?: pulumi.Input<string | undefined>; /** * Timestamp when the evaluation was created. */ createTime?: pulumi.Input<string | undefined>; /** * The user who created the evaluation. */ createdBy?: pulumi.Input<string | undefined>; /** * Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. * When a 'terraform destroy' or 'pulumi up' would delete the resource, * the command will fail if this field is set to "PREVENT" in Terraform state. * When set to "ABANDON", the command will remove the resource from Terraform * management without updating or deleting the resource in the API. * When set to "DELETE", deleting the resource is allowed. */ deletionPolicy?: pulumi.Input<string | undefined>; /** * User-defined description of the evaluation. */ description?: pulumi.Input<string | undefined>; /** * User-defined display name of the evaluation. */ displayName?: pulumi.Input<string | undefined>; /** * Etag used to ensure the object hasn't changed during a read-modify-write operation. */ etag?: pulumi.Input<string | undefined>; /** * List of evaluation datasets the evaluation belongs to. */ evaluationDatasets?: pulumi.Input<pulumi.Input<string>[] | undefined>; /** * The ID to use for the evaluation, which will become the final component of * the evaluation's resource name. If not provided, a unique ID will be * automatically assigned for the evaluation. */ evaluationId?: pulumi.Input<string | undefined>; /** * The evaluation runs for this evaluation. */ evaluationRuns?: pulumi.Input<pulumi.Input<string>[] | undefined>; /** * Golden input. * Structure is documented below. */ golden?: pulumi.Input<inputs.ces.EvaluationGolden | undefined>; /** * Whether the evaluation is invalid. */ invalid?: pulumi.Input<boolean | undefined>; /** * The user who last updated the evaluation. */ lastUpdatedBy?: pulumi.Input<string | undefined>; /** * (Required) */ location?: pulumi.Input<string | undefined>; /** * Identifier. The unique identifier of the evaluation. * Format: `projects/{project}/locations/{location}/apps/{app}/evaluations/{evaluation}` */ name?: pulumi.Input<string | undefined>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input<string | undefined>; /** * Scenario input. * Structure is documented below. */ scenario?: pulumi.Input<inputs.ces.EvaluationScenario | undefined>; /** * User defined tags to categorize the evaluation. */ tags?: pulumi.Input<pulumi.Input<string>[] | undefined>; /** * Timestamp when the evaluation was last updated. */ updateTime?: pulumi.Input<string | undefined>; } /** * The set of arguments for constructing a Evaluation resource. */ export interface EvaluationArgs { /** * (Required) */ app: pulumi.Input<string>; /** * Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. * When a 'terraform destroy' or 'pulumi up' would delete the resource, * the command will fail if this field is set to "PREVENT" in Terraform state. * When set to "ABANDON", the command will remove the resource from Terraform * management without updating or deleting the resource in the API. * When set to "DELETE", deleting the resource is allowed. */ deletionPolicy?: pulumi.Input<string | undefined>; /** * User-defined description of the evaluation. */ description?: pulumi.Input<string | undefined>; /** * User-defined display name of the evaluation. */ displayName: pulumi.Input<string>; /** * The ID to use for the evaluation, which will become the final component of * the evaluation's resource name. If not provided, a unique ID will be * automatically assigned for the evaluation. */ evaluationId: pulumi.Input<string>; /** * Golden input. * Structure is documented below. */ golden?: pulumi.Input<inputs.ces.EvaluationGolden | undefined>; /** * (Required) */ location: pulumi.Input<string>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input<string | undefined>; /** * Scenario input. * Structure is documented below. */ scenario?: pulumi.Input<inputs.ces.EvaluationScenario | undefined>; /** * User defined tags to categorize the evaluation. */ tags?: pulumi.Input<pulumi.Input<string>[] | undefined>; } //# sourceMappingURL=evaluation.d.ts.map