File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change 1010class AssistantResource extends Resource
1111{
1212 /**
13- * Start a new session with the Weather AI Assistant
13+ * Start a new session (create a news conversation) with the Weather AI Assistant
1414 *
1515 * @throws ClientExceptionInterface
1616 */
@@ -26,4 +26,24 @@ public function startSession(string $prompt): Answer
2626
2727 return new Answer ($ data );
2828 }
29+
30+ /**
31+ * Resume a session (continue a conversation) with the Weather AI Assistant
32+ *
33+ * @throws ClientExceptionInterface
34+ */
35+ public function resumeSession (string $ sessionId , string $ prompt ): Answer
36+ {
37+ $ this ->api ->setAuthentication (new Header ('X-Api-Key ' , $ this ->api ->apiKey ));
38+
39+ $ data = $ this ->api ->request (
40+ method: Method::POST ,
41+ path: $ this ->api ->buildPath ('/assistant/session/{sessionId} ' , [
42+ 'sessionId ' => $ sessionId
43+ ]),
44+ body: json_encode (['prompt ' => $ prompt ])
45+ );
46+
47+ return new Answer ($ data );
48+ }
2949}
You can’t perform that action at this time.
0 commit comments