Skip to content

Commit acac556

Browse files
committed
add embedder get and put
1 parent 3c945c1 commit acac556

File tree

2 files changed

+27
-9
lines changed

2 files changed

+27
-9
lines changed

src/CCatClient.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,29 @@ public function putLLMSettings(string $llm, array $values): LLMSettingsOutput
277277
return $this->serializer->deserialize($response->getBody()->getContents(), LLMSettingsOutput::class, 'json', []);
278278
}
279279

280+
/**
281+
* @param string $embedder
282+
* @param array<string, mixed> $values
283+
* @return LLMSettingsOutput
284+
*/
285+
public function putEmbedderSettings(string $embedder, array $values): LLMSettingsOutput
286+
{
287+
$response = $this->httpClient->getHttpClient()->put(sprintf('/embedder/settings/%s', $embedder), [
288+
'json' => $values
289+
]);
290+
return $this->serializer->deserialize($response->getBody()->getContents(), LLMSettingsOutput::class, 'json', []);
291+
}
292+
293+
/**
294+
* @param string $embedder
295+
* @return LLMSettingsOutput
296+
*/
297+
public function getEmbedderSettings(string $embedder): LLMSettingsOutput
298+
{
299+
$response = $this->httpClient->getHttpClient()->get(sprintf('/embedder/settings/%s', $embedder));
300+
return $this->serializer->deserialize($response->getBody()->getContents(), LLMSettingsOutput::class, 'json', []);
301+
}
302+
280303
/**
281304
* @param string $pluginId
282305
* @param array<string, mixed> $values

src/index.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
//
3+
44
//
55
//require dirname(__DIR__).'/vendor/autoload.php';
66
//
@@ -11,12 +11,7 @@
1111
//$cCatClient = new CCatClient(new WSClient('cheshire_cat_core'), new HttpClient('cheshire_cat_core', null, 'meow'));
1212
//
1313
//try {
14-
// $response = $cCatClient->putLLMSettings("LLMOpenAIChatConfig", [
15-
// "open_api_key" => "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",
16-
// "temperature" => 0.7,
17-
// "model_name" => "gpt-3.5-turbo",
18-
// "streaming" => true,
19-
// ]);
14+
// $response = $cCatClient->getEmbedderSettings("EmbedderOpenAIConfig");
2015
// //
2116
// // "prompt_prefix" => "You are a supportive AI that help during hard time" ,
2217
// // "episodic_memory_k" => 3,
@@ -37,5 +32,5 @@
3732
//} catch (Exception $exception) {
3833
// var_dump($exception->getMessage());
3934
//}
40-
////$response = $cCatClient->sendMessage(new \Albocode\CcatphpSdk\Model\Message("Ciao come stai?", "test"), fn($message) => var_dump($message));
41-
////var_dump($response);
35+
//$response = $cCatClient->sendMessage(new \Albocode\CcatphpSdk\Model\Message("Ciao come stai?", "test"), fn($message) => var_dump($message));
36+
//var_dump($response);

0 commit comments

Comments
 (0)