Skip to content

Commit

Permalink
add embedder get and put
Browse files Browse the repository at this point in the history
  • Loading branch information
AlboCode committed Dec 19, 2023
1 parent 3c945c1 commit acac556
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 9 deletions.
23 changes: 23 additions & 0 deletions src/CCatClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,29 @@ public function putLLMSettings(string $llm, array $values): LLMSettingsOutput
return $this->serializer->deserialize($response->getBody()->getContents(), LLMSettingsOutput::class, 'json', []);
}

/**
* @param string $embedder
* @param array<string, mixed> $values
* @return LLMSettingsOutput
*/
public function putEmbedderSettings(string $embedder, array $values): LLMSettingsOutput
{
$response = $this->httpClient->getHttpClient()->put(sprintf('/embedder/settings/%s', $embedder), [
'json' => $values
]);
return $this->serializer->deserialize($response->getBody()->getContents(), LLMSettingsOutput::class, 'json', []);
}

/**
* @param string $embedder
* @return LLMSettingsOutput
*/
public function getEmbedderSettings(string $embedder): LLMSettingsOutput
{
$response = $this->httpClient->getHttpClient()->get(sprintf('/embedder/settings/%s', $embedder));
return $this->serializer->deserialize($response->getBody()->getContents(), LLMSettingsOutput::class, 'json', []);
}

/**
* @param string $pluginId
* @param array<string, mixed> $values
Expand Down
13 changes: 4 additions & 9 deletions src/index.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

//

//
//require dirname(__DIR__).'/vendor/autoload.php';
//
Expand All @@ -11,12 +11,7 @@
//$cCatClient = new CCatClient(new WSClient('cheshire_cat_core'), new HttpClient('cheshire_cat_core', null, 'meow'));
//
//try {
// $response = $cCatClient->putLLMSettings("LLMOpenAIChatConfig", [
// "open_api_key" => "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",
// "temperature" => 0.7,
// "model_name" => "gpt-3.5-turbo",
// "streaming" => true,
// ]);
// $response = $cCatClient->getEmbedderSettings("EmbedderOpenAIConfig");
// //
// // "prompt_prefix" => "You are a supportive AI that help during hard time" ,
// // "episodic_memory_k" => 3,
Expand All @@ -37,5 +32,5 @@
//} catch (Exception $exception) {
// var_dump($exception->getMessage());
//}
////$response = $cCatClient->sendMessage(new \Albocode\CcatphpSdk\Model\Message("Ciao come stai?", "test"), fn($message) => var_dump($message));
////var_dump($response);
//$response = $cCatClient->sendMessage(new \Albocode\CcatphpSdk\Model\Message("Ciao come stai?", "test"), fn($message) => var_dump($message));
//var_dump($response);

0 comments on commit acac556

Please sign in to comment.