Skip to content

Commit 810c46f

Browse files
committed
feat: add resume session endpoint
1 parent 97cdc68 commit 810c46f

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/Resource/AssistantResource.php

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
class 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
}

0 commit comments

Comments
 (0)