Skip to content

Commit f0bd476

Browse files
UN-2427 [FEAT]: Added Get llm profile function to get the profile details. (#190)
* supporting-changes-for-dynamic-llm-profile * version bump up * version bump up --------- Signed-off-by: vishnuszipstack <[email protected]>
1 parent 2dc7dad commit f0bd476

File tree

4 files changed

+23
-1
lines changed

4 files changed

+23
-1
lines changed

src/unstract/sdk/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "v0.73.2"
1+
__version__ = "v0.74.0"
22

33

44
def get_sdk_version() -> str:

src/unstract/sdk/constants.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class AdapterKeys:
4040

4141
class PromptStudioKeys:
4242
PROMPT_REGISTRY_ID = "prompt_registry_id"
43+
LLM_PROFILE_ID = "llm_profile_id"
4344

4445

4546
class ConnectorType:
@@ -133,6 +134,7 @@ class MetadataKey:
133134
ELAPSED_TIME = "elapsed_time"
134135
OUTPUT = "output"
135136
OUTPUT_TYPE = "output_type"
137+
LLM_PROFILE_ID = "llm_profile_id"
136138

137139

138140
class ToolSettingsKey:

src/unstract/sdk/platform.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,3 +182,22 @@ def get_prompt_studio_tool(self, prompt_registry_id: str) -> dict[str, Any]:
182182
headers=None,
183183
method="GET",
184184
)
185+
186+
def get_llm_profile(self, llm_profile_id: str) -> dict[str, Any]:
187+
"""Get llm profile by the help of unstract DB tool.
188+
189+
Args:
190+
llm_profile_id (str): ID of the llm_profile_id
191+
Required env variables:
192+
PLATFORM_HOST: Host of platform service
193+
PLATFORM_PORT: Port of platform service
194+
"""
195+
query_params = {PromptStudioKeys.LLM_PROFILE_ID: llm_profile_id}
196+
return self._call_service(
197+
url_path="llm_profile_instance",
198+
payload=None,
199+
params=query_params,
200+
headers=None,
201+
method="GET",
202+
)
203+

src/unstract/sdk/tool/base.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ def from_tool_args(cls, args: list[str]) -> "BaseTool":
9393
tool.tags = tool._exec_metadata.get(MetadataKey.TAGS, [])
9494
tool.source_file_name = tool._exec_metadata.get(MetadataKey.SOURCE_NAME, "")
9595
tool.org_id = tool._exec_metadata.get(MetadataKey.ORG_ID)
96+
tool.llm_profile_id = tool._exec_metadata.get(MetadataKey.LLM_PROFILE_ID)
9697
return tool
9798

9899
def elapsed_time(self) -> float:

0 commit comments

Comments
 (0)