11package io .dapr .examples .conversation ;
22
3+ import io .dapr .ai .client .DaprConversationClient ;
4+ import io .dapr .ai .client .DaprConversationInput ;
5+ import io .dapr .ai .client .DaprConversationResponse ;
36import io .dapr .v1 .DaprProtos ;
47import reactor .core .publisher .Mono ;
58
@@ -11,18 +14,17 @@ public class DemoConversationAI {
1114 * The main method to start the client.
1215 *
1316 * @param args Input arguments (unused).
14- * @throws InterruptedException If program has been interrupted.
1517 */
1618 public static void main (String [] args ) {
1719 try (DaprConversationClient client = new DaprConversationClient (null )) {
1820 DaprConversationInput daprConversationInput = new DaprConversationInput ("11" );
19- Mono <DaprProtos .ConversationResponse > instanceId = client .converse ("openai" , new ArrayList <>(Collections .singleton (daprConversationInput )), null , null , null , false , 0.0d );
20- System .out .printf ("Started a new chaining model workflow with instance ID: %s%n" , instanceId );
21- DaprProtos .ConversationResponse response = instanceId .block ();
22-
23- System .out .println (response .getOutputsCount ());
2421
22+ // Component name is the name provided in the metadata block of the conversation.yaml file.
23+ Mono <DaprConversationResponse > instanceId = client .converse ("openai" , new ArrayList <>(Collections .singleton (daprConversationInput )), "1234" , false , 0.0d );
24+ System .out .printf ("Started a new chaining model workflow with instance ID: %s%n" , instanceId );
25+ DaprConversationResponse response = instanceId .block ();
2526
27+ System .out .println (response );
2628 } catch (Exception e ) {
2729 throw new RuntimeException (e );
2830 }
0 commit comments