langfuse.api.prompt_version.client
1# This file was auto-generated by Fern from our API Definition. 2 3import typing 4 5from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper 6from ..core.request_options import RequestOptions 7from ..prompts.types.prompt import Prompt 8from .raw_client import AsyncRawPromptVersionClient, RawPromptVersionClient 9 10# this is used as the default value for optional parameters 11OMIT = typing.cast(typing.Any, ...) 12 13 14class PromptVersionClient: 15 def __init__(self, *, client_wrapper: SyncClientWrapper): 16 self._raw_client = RawPromptVersionClient(client_wrapper=client_wrapper) 17 18 @property 19 def with_raw_response(self) -> RawPromptVersionClient: 20 """ 21 Retrieves a raw implementation of this client that returns raw responses. 22 23 Returns 24 ------- 25 RawPromptVersionClient 26 """ 27 return self._raw_client 28 29 def update( 30 self, 31 name: str, 32 version: int, 33 *, 34 new_labels: typing.Sequence[str], 35 request_options: typing.Optional[RequestOptions] = None, 36 ) -> Prompt: 37 """ 38 Update labels for a specific prompt version 39 40 Parameters 41 ---------- 42 name : str 43 The name of the prompt. If the prompt is in a folder (e.g., "folder/subfolder/prompt-name"), 44 the folder path must be URL encoded. 45 46 version : int 47 Version of the prompt to update 48 49 new_labels : typing.Sequence[str] 50 New labels for the prompt version. Labels are unique across versions. The "latest" label is reserved and managed by Langfuse. 51 52 request_options : typing.Optional[RequestOptions] 53 Request-specific configuration. 54 55 Returns 56 ------- 57 Prompt 58 59 Examples 60 -------- 61 from langfuse import LangfuseAPI 62 63 client = LangfuseAPI( 64 x_langfuse_sdk_name="YOUR_X_LANGFUSE_SDK_NAME", 65 x_langfuse_sdk_version="YOUR_X_LANGFUSE_SDK_VERSION", 66 x_langfuse_public_key="YOUR_X_LANGFUSE_PUBLIC_KEY", 67 username="YOUR_USERNAME", 68 password="YOUR_PASSWORD", 69 base_url="https://yourhost.com/path/to/api", 70 ) 71 client.prompt_version.update( 72 name="name", 73 version=1, 74 new_labels=["newLabels", "newLabels"], 75 ) 76 """ 77 _response = self._raw_client.update( 78 name, version, new_labels=new_labels, request_options=request_options 79 ) 80 return _response.data 81 82 83class AsyncPromptVersionClient: 84 def __init__(self, *, client_wrapper: AsyncClientWrapper): 85 self._raw_client = AsyncRawPromptVersionClient(client_wrapper=client_wrapper) 86 87 @property 88 def with_raw_response(self) -> AsyncRawPromptVersionClient: 89 """ 90 Retrieves a raw implementation of this client that returns raw responses. 91 92 Returns 93 ------- 94 AsyncRawPromptVersionClient 95 """ 96 return self._raw_client 97 98 async def update( 99 self, 100 name: str, 101 version: int, 102 *, 103 new_labels: typing.Sequence[str], 104 request_options: typing.Optional[RequestOptions] = None, 105 ) -> Prompt: 106 """ 107 Update labels for a specific prompt version 108 109 Parameters 110 ---------- 111 name : str 112 The name of the prompt. If the prompt is in a folder (e.g., "folder/subfolder/prompt-name"), 113 the folder path must be URL encoded. 114 115 version : int 116 Version of the prompt to update 117 118 new_labels : typing.Sequence[str] 119 New labels for the prompt version. Labels are unique across versions. The "latest" label is reserved and managed by Langfuse. 120 121 request_options : typing.Optional[RequestOptions] 122 Request-specific configuration. 123 124 Returns 125 ------- 126 Prompt 127 128 Examples 129 -------- 130 import asyncio 131 132 from langfuse import AsyncLangfuseAPI 133 134 client = AsyncLangfuseAPI( 135 x_langfuse_sdk_name="YOUR_X_LANGFUSE_SDK_NAME", 136 x_langfuse_sdk_version="YOUR_X_LANGFUSE_SDK_VERSION", 137 x_langfuse_public_key="YOUR_X_LANGFUSE_PUBLIC_KEY", 138 username="YOUR_USERNAME", 139 password="YOUR_PASSWORD", 140 base_url="https://yourhost.com/path/to/api", 141 ) 142 143 144 async def main() -> None: 145 await client.prompt_version.update( 146 name="name", 147 version=1, 148 new_labels=["newLabels", "newLabels"], 149 ) 150 151 152 asyncio.run(main()) 153 """ 154 _response = await self._raw_client.update( 155 name, version, new_labels=new_labels, request_options=request_options 156 ) 157 return _response.data
15class PromptVersionClient: 16 def __init__(self, *, client_wrapper: SyncClientWrapper): 17 self._raw_client = RawPromptVersionClient(client_wrapper=client_wrapper) 18 19 @property 20 def with_raw_response(self) -> RawPromptVersionClient: 21 """ 22 Retrieves a raw implementation of this client that returns raw responses. 23 24 Returns 25 ------- 26 RawPromptVersionClient 27 """ 28 return self._raw_client 29 30 def update( 31 self, 32 name: str, 33 version: int, 34 *, 35 new_labels: typing.Sequence[str], 36 request_options: typing.Optional[RequestOptions] = None, 37 ) -> Prompt: 38 """ 39 Update labels for a specific prompt version 40 41 Parameters 42 ---------- 43 name : str 44 The name of the prompt. If the prompt is in a folder (e.g., "folder/subfolder/prompt-name"), 45 the folder path must be URL encoded. 46 47 version : int 48 Version of the prompt to update 49 50 new_labels : typing.Sequence[str] 51 New labels for the prompt version. Labels are unique across versions. The "latest" label is reserved and managed by Langfuse. 52 53 request_options : typing.Optional[RequestOptions] 54 Request-specific configuration. 55 56 Returns 57 ------- 58 Prompt 59 60 Examples 61 -------- 62 from langfuse import LangfuseAPI 63 64 client = LangfuseAPI( 65 x_langfuse_sdk_name="YOUR_X_LANGFUSE_SDK_NAME", 66 x_langfuse_sdk_version="YOUR_X_LANGFUSE_SDK_VERSION", 67 x_langfuse_public_key="YOUR_X_LANGFUSE_PUBLIC_KEY", 68 username="YOUR_USERNAME", 69 password="YOUR_PASSWORD", 70 base_url="https://yourhost.com/path/to/api", 71 ) 72 client.prompt_version.update( 73 name="name", 74 version=1, 75 new_labels=["newLabels", "newLabels"], 76 ) 77 """ 78 _response = self._raw_client.update( 79 name, version, new_labels=new_labels, request_options=request_options 80 ) 81 return _response.data
19 @property 20 def with_raw_response(self) -> RawPromptVersionClient: 21 """ 22 Retrieves a raw implementation of this client that returns raw responses. 23 24 Returns 25 ------- 26 RawPromptVersionClient 27 """ 28 return self._raw_client
Retrieves a raw implementation of this client that returns raw responses.
Returns
RawPromptVersionClient
30 def update( 31 self, 32 name: str, 33 version: int, 34 *, 35 new_labels: typing.Sequence[str], 36 request_options: typing.Optional[RequestOptions] = None, 37 ) -> Prompt: 38 """ 39 Update labels for a specific prompt version 40 41 Parameters 42 ---------- 43 name : str 44 The name of the prompt. If the prompt is in a folder (e.g., "folder/subfolder/prompt-name"), 45 the folder path must be URL encoded. 46 47 version : int 48 Version of the prompt to update 49 50 new_labels : typing.Sequence[str] 51 New labels for the prompt version. Labels are unique across versions. The "latest" label is reserved and managed by Langfuse. 52 53 request_options : typing.Optional[RequestOptions] 54 Request-specific configuration. 55 56 Returns 57 ------- 58 Prompt 59 60 Examples 61 -------- 62 from langfuse import LangfuseAPI 63 64 client = LangfuseAPI( 65 x_langfuse_sdk_name="YOUR_X_LANGFUSE_SDK_NAME", 66 x_langfuse_sdk_version="YOUR_X_LANGFUSE_SDK_VERSION", 67 x_langfuse_public_key="YOUR_X_LANGFUSE_PUBLIC_KEY", 68 username="YOUR_USERNAME", 69 password="YOUR_PASSWORD", 70 base_url="https://yourhost.com/path/to/api", 71 ) 72 client.prompt_version.update( 73 name="name", 74 version=1, 75 new_labels=["newLabels", "newLabels"], 76 ) 77 """ 78 _response = self._raw_client.update( 79 name, version, new_labels=new_labels, request_options=request_options 80 ) 81 return _response.data
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"], )
84class AsyncPromptVersionClient: 85 def __init__(self, *, client_wrapper: AsyncClientWrapper): 86 self._raw_client = AsyncRawPromptVersionClient(client_wrapper=client_wrapper) 87 88 @property 89 def with_raw_response(self) -> AsyncRawPromptVersionClient: 90 """ 91 Retrieves a raw implementation of this client that returns raw responses. 92 93 Returns 94 ------- 95 AsyncRawPromptVersionClient 96 """ 97 return self._raw_client 98 99 async def update( 100 self, 101 name: str, 102 version: int, 103 *, 104 new_labels: typing.Sequence[str], 105 request_options: typing.Optional[RequestOptions] = None, 106 ) -> Prompt: 107 """ 108 Update labels for a specific prompt version 109 110 Parameters 111 ---------- 112 name : str 113 The name of the prompt. If the prompt is in a folder (e.g., "folder/subfolder/prompt-name"), 114 the folder path must be URL encoded. 115 116 version : int 117 Version of the prompt to update 118 119 new_labels : typing.Sequence[str] 120 New labels for the prompt version. Labels are unique across versions. The "latest" label is reserved and managed by Langfuse. 121 122 request_options : typing.Optional[RequestOptions] 123 Request-specific configuration. 124 125 Returns 126 ------- 127 Prompt 128 129 Examples 130 -------- 131 import asyncio 132 133 from langfuse import AsyncLangfuseAPI 134 135 client = AsyncLangfuseAPI( 136 x_langfuse_sdk_name="YOUR_X_LANGFUSE_SDK_NAME", 137 x_langfuse_sdk_version="YOUR_X_LANGFUSE_SDK_VERSION", 138 x_langfuse_public_key="YOUR_X_LANGFUSE_PUBLIC_KEY", 139 username="YOUR_USERNAME", 140 password="YOUR_PASSWORD", 141 base_url="https://yourhost.com/path/to/api", 142 ) 143 144 145 async def main() -> None: 146 await client.prompt_version.update( 147 name="name", 148 version=1, 149 new_labels=["newLabels", "newLabels"], 150 ) 151 152 153 asyncio.run(main()) 154 """ 155 _response = await self._raw_client.update( 156 name, version, new_labels=new_labels, request_options=request_options 157 ) 158 return _response.data
88 @property 89 def with_raw_response(self) -> AsyncRawPromptVersionClient: 90 """ 91 Retrieves a raw implementation of this client that returns raw responses. 92 93 Returns 94 ------- 95 AsyncRawPromptVersionClient 96 """ 97 return self._raw_client
Retrieves a raw implementation of this client that returns raw responses.
Returns
AsyncRawPromptVersionClient
99 async def update( 100 self, 101 name: str, 102 version: int, 103 *, 104 new_labels: typing.Sequence[str], 105 request_options: typing.Optional[RequestOptions] = None, 106 ) -> Prompt: 107 """ 108 Update labels for a specific prompt version 109 110 Parameters 111 ---------- 112 name : str 113 The name of the prompt. If the prompt is in a folder (e.g., "folder/subfolder/prompt-name"), 114 the folder path must be URL encoded. 115 116 version : int 117 Version of the prompt to update 118 119 new_labels : typing.Sequence[str] 120 New labels for the prompt version. Labels are unique across versions. The "latest" label is reserved and managed by Langfuse. 121 122 request_options : typing.Optional[RequestOptions] 123 Request-specific configuration. 124 125 Returns 126 ------- 127 Prompt 128 129 Examples 130 -------- 131 import asyncio 132 133 from langfuse import AsyncLangfuseAPI 134 135 client = AsyncLangfuseAPI( 136 x_langfuse_sdk_name="YOUR_X_LANGFUSE_SDK_NAME", 137 x_langfuse_sdk_version="YOUR_X_LANGFUSE_SDK_VERSION", 138 x_langfuse_public_key="YOUR_X_LANGFUSE_PUBLIC_KEY", 139 username="YOUR_USERNAME", 140 password="YOUR_PASSWORD", 141 base_url="https://yourhost.com/path/to/api", 142 ) 143 144 145 async def main() -> None: 146 await client.prompt_version.update( 147 name="name", 148 version=1, 149 new_labels=["newLabels", "newLabels"], 150 ) 151 152 153 asyncio.run(main()) 154 """ 155 _response = await self._raw_client.update( 156 name, version, new_labels=new_labels, request_options=request_options 157 ) 158 return _response.data
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())