import com.google.cloud.dialogflow.v2.Agent;
import com.google.cloud.dialogflow.v2.Agent.Builder;
import com.google.cloud.dialogflow.v2.AgentsClient;
import com.google.cloud.dialogflow.v2.AgentsSettings;
import java.io.IOException;
public class SetAgent {
public static void main(String[] args) throws IOException {
String projectId = "my-project-id";
// The display name will set the name of your agent
String displayName = "my-display-name";
setAgent(projectId, displayName);
}
public static Agent setAgent(String parent, String displayName) throws IOException {
AgentsSettings agentsSettings = AgentsSettings.newBuilder().build();
try (AgentsClient client = AgentsClient.create(agentsSettings)) {
// Set the details of the Agent to create
Builder build = Agent.newBuilder();
build.setDefaultLanguageCode("en");
build.setDisplayName(displayName);
Agent agent = build.build();
// Make API request to create agent
Agent response = client.setAgent(agent);
System.out.println(response);
return response;
}
}
}
[[["わかりやすい","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-06-27 UTC。"],[],[]]