Edit on GitHub

langfuse.api.prompt_version.client

OMIT = Ellipsis
class PromptVersionClient:
PromptVersionClient( *, client_wrapper: langfuse.api.core.client_wrapper.SyncClientWrapper)

Retrieves a raw implementation of this client that returns raw responses.

Returns

RawPromptVersionClient

def update( self, name: str, version: int, *, new_labels: Sequence[str], request_options: Optional[langfuse.api.core.request_options.RequestOptions] = None) -> Annotated[Union[langfuse.api.Prompt_Chat, langfuse.api.Prompt_Text], FieldInfo(annotation=NoneType, required=True, discriminator='type')]:

Update labels for a specific prompt version

Parameters

name : str The name of the prompt. If the prompt is in a folder (e.g., "folder/subfolder/prompt-name"), the folder path must be URL encoded.

version : int Version of the prompt to update

new_labels : typing.Sequence[str] New labels for the prompt version. Labels are unique across versions. The "latest" label is reserved and managed by Langfuse.

request_options : typing.Optional[RequestOptions] Request-specific configuration.

Returns

Prompt

Examples

from langfuse import LangfuseAPI

client = LangfuseAPI( x_langfuse_sdk_name="YOUR_X_LANGFUSE_SDK_NAME", x_langfuse_sdk_version="YOUR_X_LANGFUSE_SDK_VERSION", x_langfuse_public_key="YOUR_X_LANGFUSE_PUBLIC_KEY", username="YOUR_USERNAME", password="YOUR_PASSWORD", base_url="https://yourhost.com/path/to/api", ) client.prompt_version.update( name="name", version=1, new_labels=["newLabels", "newLabels"], )

class AsyncPromptVersionClient:
AsyncPromptVersionClient( *, client_wrapper: langfuse.api.core.client_wrapper.AsyncClientWrapper)

Retrieves a raw implementation of this client that returns raw responses.

Returns

AsyncRawPromptVersionClient

async def update( self, name: str, version: int, *, new_labels: Sequence[str], request_options: Optional[langfuse.api.core.request_options.RequestOptions] = None) -> Annotated[Union[langfuse.api.Prompt_Chat, langfuse.api.Prompt_Text], FieldInfo(annotation=NoneType, required=True, discriminator='type')]:

Update labels for a specific prompt version

Parameters

name : str The name of the prompt. If the prompt is in a folder (e.g., "folder/subfolder/prompt-name"), the folder path must be URL encoded.

version : int Version of the prompt to update

new_labels : typing.Sequence[str] New labels for the prompt version. Labels are unique across versions. The "latest" label is reserved and managed by Langfuse.

request_options : typing.Optional[RequestOptions] Request-specific configuration.

Returns

Prompt

Examples

import asyncio

from langfuse import AsyncLangfuseAPI

client = AsyncLangfuseAPI( x_langfuse_sdk_name="YOUR_X_LANGFUSE_SDK_NAME", x_langfuse_sdk_version="YOUR_X_LANGFUSE_SDK_VERSION", x_langfuse_public_key="YOUR_X_LANGFUSE_PUBLIC_KEY", username="YOUR_USERNAME", password="YOUR_PASSWORD", base_url="https://yourhost.com/path/to/api", )

async def main() -> None: await client.prompt_version.update( name="name", version=1, new_labels=["newLabels", "newLabels"], )

asyncio.run(main())