mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-10-05 20:27:35 +00:00
fixed update_prompt to properly handle latest and default version, made version a required parameter, and removed unused CreatePromptRequest
Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
This commit is contained in:
parent
1390660dcf
commit
beb2db487d
6 changed files with 43 additions and 41 deletions
|
@ -4,6 +4,6 @@
|
|||
# This source code is licensed under the terms described in the LICENSE file in
|
||||
# the root directory of this source tree.
|
||||
|
||||
from .prompts import CreatePromptRequest, ListPromptsResponse, Prompt, Prompts, UpdatePromptRequest
|
||||
from .prompts import ListPromptsResponse, Prompt, Prompts, UpdatePromptRequest
|
||||
|
||||
__all__ = ["Prompt", "Prompts", "ListPromptsResponse", "CreatePromptRequest", "UpdatePromptRequest"]
|
||||
__all__ = ["Prompt", "Prompts", "ListPromptsResponse", "UpdatePromptRequest"]
|
||||
|
|
|
@ -21,7 +21,7 @@ class Prompt(BaseModel):
|
|||
:param prompt: The system prompt text with variable placeholders. Variables are only supported when using the Responses API.
|
||||
:param version: Version string (integer start at 1 cast as string, incremented on save)
|
||||
:param prompt_id: Unique identifier formatted as 'pmpt_<48-digit-hash>'
|
||||
:param variables: Dictionary of prompt variable names and values
|
||||
:param variables: List of prompt variable names that can be used in the prompt template
|
||||
:param is_default: Boolean indicating whether this version is the default version for this prompt
|
||||
"""
|
||||
|
||||
|
@ -90,13 +90,6 @@ class Prompt(BaseModel):
|
|||
return f"pmpt_{hex_string}"
|
||||
|
||||
|
||||
class CreatePromptRequest(BaseModel):
|
||||
"""Request model to create a prompt."""
|
||||
|
||||
prompt: str = Field(description="The prompt text content")
|
||||
variables: list[str] = Field(default_factory=list, description="List of variable names for dynamic injection")
|
||||
|
||||
|
||||
class UpdatePromptRequest(BaseModel):
|
||||
"""Request model for updating a prompt."""
|
||||
|
||||
|
@ -168,15 +161,15 @@ class Prompts(Protocol):
|
|||
self,
|
||||
prompt_id: str,
|
||||
prompt: str,
|
||||
version: str,
|
||||
variables: list[str] | None = None,
|
||||
version: str | None = None,
|
||||
) -> Prompt:
|
||||
"""Update an existing prompt (increments version).
|
||||
|
||||
:param prompt_id: The identifier of the prompt to update.
|
||||
:param prompt: The updated prompt text content.
|
||||
:param variables: Updated list of variable names that can be used in the prompt template.
|
||||
:param version: The current version of the prompt being updated (as a string).
|
||||
:param variables: Updated list of variable names that can be used in the prompt template.
|
||||
:returns: The updated Prompt resource with incremented version.
|
||||
"""
|
||||
...
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue