1
1
package io .dapr .examples .conversation ;
2
2
3
+ import io .dapr .ai .client .DaprConversationClient ;
4
+ import io .dapr .ai .client .DaprConversationInput ;
5
+ import io .dapr .ai .client .DaprConversationResponse ;
3
6
import io .dapr .v1 .DaprProtos ;
4
7
import reactor .core .publisher .Mono ;
5
8
@@ -11,18 +14,17 @@ public class DemoConversationAI {
11
14
* The main method to start the client.
12
15
*
13
16
* @param args Input arguments (unused).
14
- * @throws InterruptedException If program has been interrupted.
15
17
*/
16
18
public static void main (String [] args ) {
17
19
try (DaprConversationClient client = new DaprConversationClient (null )) {
18
20
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 ());
24
21
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 ();
25
26
27
+ System .out .println (response );
26
28
} catch (Exception e ) {
27
29
throw new RuntimeException (e );
28
30
}
0 commit comments