mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-10-05 04:17:32 +00:00
add set_as_default in update_prompt and in API with default to True, also fix tests to actualy use temp_prompt_store (with some modifications)
Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
This commit is contained in:
parent
64f6840195
commit
54fcdf1d3d
6 changed files with 91 additions and 80 deletions
|
@ -154,6 +154,7 @@ class PromptServiceImpl(Prompts):
|
|||
prompt: str,
|
||||
version: int,
|
||||
variables: list[str] | None = None,
|
||||
set_as_default: bool = True,
|
||||
) -> Prompt:
|
||||
"""Update an existing prompt (increments version)."""
|
||||
if version < 1:
|
||||
|
@ -178,8 +179,8 @@ class PromptServiceImpl(Prompts):
|
|||
data = self._serialize_prompt(updated_prompt)
|
||||
await self.kvstore.set(version_key, data)
|
||||
|
||||
default_key = self._get_default_key(prompt_id)
|
||||
await self.kvstore.set(default_key, str(new_version))
|
||||
if set_as_default:
|
||||
await self.set_default_version(prompt_id, new_version)
|
||||
|
||||
return updated_prompt
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue