From 77678047572f8c72853cdf5bfeb2390dc89002e5 Mon Sep 17 00:00:00 2001 From: Arnav Jain Date: Sat, 24 May 2025 04:17:10 +0000 Subject: [PATCH 1/2] add default app id parameter for curator llm --- src/bespokelabs/curator/llm/llm.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/bespokelabs/curator/llm/llm.py b/src/bespokelabs/curator/llm/llm.py index a43c14e0..e2491a8e 100644 --- a/src/bespokelabs/curator/llm/llm.py +++ b/src/bespokelabs/curator/llm/llm.py @@ -78,6 +78,7 @@ def __init__( generation_params: dict | None = None, backend_params: BackendParamsType | None = None, system_prompt: str | None = None, + default_app_id: Optional[str] = None, ): """Initialize a LLM. @@ -117,6 +118,7 @@ def __init__( - gpu_memory_utilization: The GPU memory utilization to use for the VLLM backend - batch_size: The size of the batch to use, only used if batch is True system_prompt: The system prompt to use for the LLM + default_app_id: The default application ID to use when opening datasets in Curator Viewer """ generation_params = generation_params or {} @@ -143,6 +145,8 @@ def __init__( return_completions_object=self.return_completions_object, ) + self.default_app_id = default_app_id + def _hash_fingerprint(self, dataset_hash: str = "", disable_cache: bool = False): if disable_cache: fingerprint = xxh64(os.urandom(8)).hexdigest() @@ -261,6 +265,7 @@ def __call__( "response_format": (str(self.prompt_formatter.response_format.model_json_schema()) if self.prompt_formatter.response_format else "text"), "run_hash": fingerprint, "batch_mode": self.batch_mode, + "default_app_id": self.default_app_id, } existing_session_id = metadata_db.get_existing_session_id(metadata_dict["run_hash"]) From e834570b30a8d4826a9d8c1657d9c2335ef0bc2e Mon Sep 17 00:00:00 2001 From: Arnav Jain Date: Tue, 27 May 2025 06:18:01 +0000 Subject: [PATCH 2/2] null value fix for default app id --- src/bespokelabs/curator/llm/llm.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/bespokelabs/curator/llm/llm.py b/src/bespokelabs/curator/llm/llm.py index e2491a8e..833e16cc 100644 --- a/src/bespokelabs/curator/llm/llm.py +++ b/src/bespokelabs/curator/llm/llm.py @@ -265,8 +265,11 @@ def __call__( "response_format": (str(self.prompt_formatter.response_format.model_json_schema()) if self.prompt_formatter.response_format else "text"), "run_hash": fingerprint, "batch_mode": self.batch_mode, - "default_app_id": self.default_app_id, } + + # Only include default_app_id in metadata dictionary if it's not None + if self.default_app_id is not None: + metadata_dict["default_app_id"] = self.default_app_id existing_session_id = metadata_db.get_existing_session_id(metadata_dict["run_hash"]) existing_viewer_sync = metadata_db.check_existing_hosted_sync(metadata_dict["run_hash"])