CTS에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다.
자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.
importcom.google.api.gax.longrunning.OperationFuture;importcom.google.cloud.dialogflow.cx.v3.AgentName;importcom.google.cloud.dialogflow.cx.v3.AgentsClient;importcom.google.cloud.dialogflow.cx.v3.AgentsSettings;importcom.google.cloud.dialogflow.cx.v3.ExportAgentRequest;importcom.google.cloud.dialogflow.cx.v3.ExportAgentResponse;importcom.google.protobuf.Struct;importjava.io.IOException;importjava.util.concurrent.ExecutionException;publicclassExportAgent{publicstaticvoidmain(String[]args)throwsIOException,InterruptedException,ExecutionException{// TODO(developer): Replace these variables before running the sample.StringprojectId="my-project-id";StringagentId="my-agent-id";Stringlocation="my-location";exportAgent(projectId,agentId,location);}publicstaticvoidexportAgent(StringprojectId,StringagentId,Stringlocation)throwsIOException,InterruptedException,ExecutionException{// Sets the api endpoint to specified locationStringapiEndpoint=String.format("%s-dialogflow.googleapis.com:443",location);AgentsSettingsagentsSettings=AgentsSettings.newBuilder().setEndpoint(apiEndpoint).build();// Note: close() needs to be called on the AgentsClient object to clean up resources// such as threads. In the example below, try-with-resources is used,// which automatically calls close().try(AgentsClientagentsClient=AgentsClient.create(agentsSettings)){ExportAgentRequestrequest=ExportAgentRequest.newBuilder().setName(AgentName.of(projectId,location,agentId).toString()).build();// Returns a future of the operationOperationFuture<ExportAgentResponse,Struct>future=agentsClient.exportAgentOperationCallable().futureCall(request);// get the export agent response after the operation is completedExportAgentResponseresponse=future.get();System.out.println(response);}}}
Node.js
CTS에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다.
자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.
const{AgentsClient,protos}=require('@google-cloud/dialogflow-cx');constapi_endpoint=`${location}-dialogflow.googleapis.com`;constclient=newAgentsClient({apiEndpoint:api_endpoint});constexportAgentRequest=newprotos.google.cloud.dialogflow.cx.v3.ExportAgentRequest();exportAgentRequest.name=`projects/${projectId}/locations/${location}/agents/${agentId}`;// exportAgent call returns a promise to a long running operationconst[operation]=awaitclient.exportAgent(exportAgentRequest);// Waiting for the long running opporation to finishconst[response]=awaitoperation.promise();// Prints the result of the operation when the operation is doneconsole.log(response);
Python
CTS에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다.
자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.
fromgoogle.cloud.dialogflowcx_v3.services.agents.clientimportAgentsClientfromgoogle.cloud.dialogflowcx_v3.types.agentimportExportAgentRequestdefexport_long_running_agent(project_id,agent_id,location):api_endpoint=f"{location}-dialogflow.googleapis.com:443"
client_options={"api_endpoint":api_endpoint}agents_client=AgentsClient(client_options=client_options)export_request=ExportAgentRequest()export_request.name=(f"projects/{project_id}/locations/{location}/agents/{agent_id}"
)# export_agent returns a long running operationoperation=agents_client.export_agent(request=export_request)# Returns the result of the operation when the operation is donereturnoperation.result()
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2024-11-24(UTC)"],[],[]]