palimpzest 1.2.0__py3-none-any.whl → 1.3.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
palimpzest/constants.py CHANGED
@@ -31,9 +31,9 @@ class Model(str, Enum):
31
31
  GEMINI_2_0_FLASH = "vertex_ai/gemini-2.0-flash"
32
32
  GEMINI_2_5_FLASH = "vertex_ai/gemini-2.5-flash"
33
33
  GEMINI_2_5_PRO = "vertex_ai/gemini-2.5-pro"
34
- GOOGLE_GEMINI_2_5_FLASH = "google/gemini-2.5-flash"
35
- GOOGLE_GEMINI_2_5_FLASH_LITE = "google/gemini-2.5-flash-lite"
36
- GOOGLE_GEMINI_2_5_PRO = "google/gemini-2.5-pro"
34
+ GOOGLE_GEMINI_2_5_FLASH = "gemini/gemini-2.5-flash"
35
+ GOOGLE_GEMINI_2_5_FLASH_LITE = "gemini/gemini-2.5-flash-lite"
36
+ GOOGLE_GEMINI_2_5_PRO = "gemini/gemini-2.5-pro"
37
37
  LLAMA_4_MAVERICK = "vertex_ai/meta/llama-4-maverick-17b-128e-instruct-maas"
38
38
  GPT_4o_AUDIO_PREVIEW = "openai/gpt-4o-audio-preview"
39
39
  GPT_4o_MINI_AUDIO_PREVIEW = "openai/gpt-4o-mini-audio-preview"
@@ -72,8 +72,8 @@ class Model(str, Enum):
72
72
  def is_vertex_model(self):
73
73
  return "vertex_ai" in self.value.lower()
74
74
 
75
- def is_google_model(self):
76
- return "google" in self.value.lower()
75
+ def is_google_ai_studio_model(self):
76
+ return "gemini/" in self.value.lower()
77
77
 
78
78
  def is_vllm_model(self):
79
79
  return "hosted_vllm" in self.value.lower()
@@ -27,7 +27,7 @@ class QueryProcessorConfig(BaseModel):
27
27
  join_parallelism: int = Field(default=64)
28
28
  batch_size: int | None = Field(default=None)
29
29
  reasoning_effort: str | None = Field(default=None) # Gemini: "disable", "low", "medium", "high"
30
- use_vertex: bool = Field(default=True) # Whether to use Vertex models for Gemini or Google models
30
+ use_vertex: bool = Field(default=False) # Whether to use Vertex models for Gemini or Google models
31
31
  gemini_credentials_path: str | None = Field(default=None) # Path to Gemini credentials file
32
32
  api_base: str | None = Field(default=None) # API base URL for vLLM
33
33
 
@@ -2,6 +2,8 @@ import logging
2
2
  import os
3
3
  from enum import Enum
4
4
 
5
+ from dotenv import load_dotenv
6
+
5
7
  from palimpzest.core.data.dataset import Dataset
6
8
  from palimpzest.core.elements.records import DataRecordCollection
7
9
  from palimpzest.query.execution.execution_strategy import ExecutionStrategy, SentinelExecutionStrategy
@@ -108,7 +110,7 @@ class QueryProcessorFactory:
108
110
  raise ValueError("ANTHROPIC_API_KEY must be set to use Anthropic models.")
109
111
  if model.is_together_model() and not together_key:
110
112
  raise ValueError("TOGETHER_API_KEY must be set to use Together models.")
111
- if model.is_google_model() and not (gemini_key or google_key or config.gemini_credentials_path):
113
+ if model.is_google_ai_studio_model() and not (gemini_key or google_key or config.gemini_credentials_path):
112
114
  raise ValueError("GEMINI_API_KEY, GOOGLE_API_KEY, or gemini_credentials path must be set to use Google Gemini models.")
113
115
  if model.is_vllm_model() and config.api_base is None:
114
116
  raise ValueError("api_base must be set to use vLLM models.")
@@ -194,6 +196,7 @@ class QueryProcessorFactory:
194
196
  train_dataset: dict[str, Dataset] | None = None,
195
197
  validator: Validator | None = None,
196
198
  ) -> DataRecordCollection:
199
+ load_dotenv(override=True)
197
200
  logger.info(f"Creating processor for dataset: {dataset}")
198
201
  processor = cls.create_processor(dataset, config, train_dataset, validator)
199
202
  logger.info(f"Created processor: {processor}")
@@ -3,13 +3,12 @@ import os
3
3
  from palimpzest.constants import Model
4
4
 
5
5
 
6
- # TODO: better handle vertex vs. google for gemini models
7
- def get_models(include_embedding: bool = False, use_vertex: bool = True, gemini_credentials_path: str | None = None, api_base: str | None = None) -> list[Model]:
6
+ def get_models(include_embedding: bool = False, use_vertex: bool = False, gemini_credentials_path: str | None = None, api_base: str | None = None) -> list[Model]:
8
7
  """
9
8
  Return the set of models which the system has access to based on the set environment variables.
10
9
  """
11
10
  models = []
12
- if os.getenv("OPENAI_API_KEY") is not None:
11
+ if os.getenv("OPENAI_API_KEY") not in [None, ""]:
13
12
  openai_models = [model for model in Model if model.is_openai_model()]
14
13
  if not include_embedding:
15
14
  openai_models = [
@@ -17,7 +16,7 @@ def get_models(include_embedding: bool = False, use_vertex: bool = True, gemini_
17
16
  ]
18
17
  models.extend(openai_models)
19
18
 
20
- if os.getenv("TOGETHER_API_KEY") is not None:
19
+ if os.getenv("TOGETHER_API_KEY") not in [None, ""]:
21
20
  together_models = [model for model in Model if model.is_together_model()]
22
21
  if not include_embedding:
23
22
  together_models = [
@@ -25,7 +24,7 @@ def get_models(include_embedding: bool = False, use_vertex: bool = True, gemini_
25
24
  ]
26
25
  models.extend(together_models)
27
26
 
28
- if os.getenv("ANTHROPIC_API_KEY") is not None:
27
+ if os.getenv("ANTHROPIC_API_KEY") not in [None, ""]:
29
28
  anthropic_models = [model for model in Model if model.is_anthropic_model()]
30
29
  if not include_embedding:
31
30
  anthropic_models = [
@@ -38,9 +37,9 @@ def get_models(include_embedding: bool = False, use_vertex: bool = True, gemini_
38
37
  if gemini_credentials_path is None
39
38
  else gemini_credentials_path
40
39
  )
41
- if os.getenv("GEMINI_API_KEY") is not None or os.path.exists(gemini_credentials_path):
40
+ if os.getenv("GEMINI_API_KEY") not in [None, ""] or (use_vertex and os.path.exists(gemini_credentials_path)):
42
41
  vertex_models = [model for model in Model if model.is_vertex_model()]
43
- google_models = [model for model in Model if model.is_google_model()]
42
+ google_ai_studio_models = [model for model in Model if model.is_google_ai_studio_model()]
44
43
  if not include_embedding:
45
44
  vertex_models = [
46
45
  model for model in vertex_models if not model.is_embedding_model()
@@ -48,7 +47,7 @@ def get_models(include_embedding: bool = False, use_vertex: bool = True, gemini_
48
47
  if use_vertex:
49
48
  models.extend(vertex_models)
50
49
  else:
51
- models.extend(google_models)
50
+ models.extend(google_ai_studio_models)
52
51
 
53
52
  if api_base is not None:
54
53
  vllm_models = [model for model in Model if model.is_vllm_model()]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: palimpzest
3
- Version: 1.2.0
3
+ Version: 1.3.0
4
4
  Summary: Palimpzest is a system which enables anyone to process AI-powered analytical queries simply by defining them in a declarative language
5
5
  Author-email: MIT DSG Semantic Management Lab <michjc@csail.mit.edu>
6
6
  Project-URL: homepage, https://palimpzest.org
@@ -34,6 +34,7 @@ Requires-Dist: PyLD>=2.0.4
34
34
  Requires-Dist: pyarrow>=20.0.0
35
35
  Requires-Dist: pypdf>=5.1.0
36
36
  Requires-Dist: pytest-mock>=3.14.0
37
+ Requires-Dist: python-dotenv>=1.2.1
37
38
  Requires-Dist: pyyaml>=6.0.1
38
39
  Requires-Dist: requests>=2.25
39
40
  Requires-Dist: ruff>=0.9.0
@@ -1,5 +1,5 @@
1
1
  palimpzest/__init__.py,sha256=1PzadDDOVMQJKNEYUH0_tw8tQKUYTT31M0vuzTr2Rqk,1694
2
- palimpzest/constants.py,sha256=R_vNt3FW9MA4-HuszrGyGtDLRE9YMLXRMwX5GZcRH38,23323
2
+ palimpzest/constants.py,sha256=kfuDTdSdeTCWp2JJopeuwpGIf8MC6jQ8SDBFuRIhN3k,23334
3
3
  palimpzest/policy.py,sha256=lIvw_C_rmwCH4LZaeNkAuixl8zw9RAW_JcSWSHPjKyc,11628
4
4
  palimpzest/agents/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  palimpzest/agents/compute_agents.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -71,9 +71,9 @@ palimpzest/query/optimizer/primitives.py,sha256=jMMVq37y1tWiPU1lSSKQP9OP-mzkpSxS
71
71
  palimpzest/query/optimizer/rules.py,sha256=awhe76trskv5Tq5E2QHpUN_YV6jH8INywa0Ige8IIhY,53341
72
72
  palimpzest/query/optimizer/tasks.py,sha256=DNJjY2QldfKFWj6INHElMh88dYc36Z5m3wHwbs4jyF4,30455
73
73
  palimpzest/query/processor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
74
- palimpzest/query/processor/config.py,sha256=8-MpPYHv2SI4dub4MP_gOYSRxO80_ALLuWRxD-F2YOg,2521
74
+ palimpzest/query/processor/config.py,sha256=rVpXNfzJvYstNZ2PxhQMWBpHCmjLDfiKh4ERKWRojc0,2522
75
75
  palimpzest/query/processor/query_processor.py,sha256=T4ffPbnOX23G8FDITzmM7Iw7DUEDWIHnwl8XLYllgjg,6240
76
- palimpzest/query/processor/query_processor_factory.py,sha256=l9f0C0lngOihZDzH0TK9WdKR9CwwgB6IbNZftonSFR0,9576
76
+ palimpzest/query/processor/query_processor_factory.py,sha256=qED6pJtJJXVci2a4nScURSpJohrz1LIW6tXY05un2R8,9653
77
77
  palimpzest/schemabuilder/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
78
78
  palimpzest/schemabuilder/schema_builder.py,sha256=QraGp66dcD-ej6Y2mER40o86G9JqlBkL7swkJzjUAIY,7968
79
79
  palimpzest/tools/README.md,sha256=56_6LPG80uc0CLVhTBP6I1wgIffNv9cyTr0TmVZqmrM,483
@@ -84,13 +84,13 @@ palimpzest/tools/skema_tools.py,sha256=HXUFpjMhbVxZwKKkATeK-FwtlTCawaCbeP-uHntI1
84
84
  palimpzest/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
85
85
  palimpzest/utils/env_helpers.py,sha256=n81KzoJ459pRxo7QmJA7duazwWsfoMGTHc71D2LatFk,334
86
86
  palimpzest/utils/hash_helpers.py,sha256=3A8dA7SbXTwnnvZvPVNqqMLlVRhCKyKF_bjNNAu3Exk,334
87
- palimpzest/utils/model_helpers.py,sha256=X6SlMgD5I5Aj_cxaFaoGaaNvOOqTNZVmjj6zbfn63Yk,2476
87
+ palimpzest/utils/model_helpers.py,sha256=SqcY8rWzZ7D3Vgeq8d4OGNLGv4dXXVMWiJDqSCaalRQ,2490
88
88
  palimpzest/utils/progress.py,sha256=eHXrTPTCRHjMdK0EjYRUzSxcV6N1lK8TS3Ju_ZlQLhY,22002
89
89
  palimpzest/utils/udfs.py,sha256=LjHic54B1az-rKgNLur0wOpaz2ko_UodjLEJrazkxvY,1854
90
90
  palimpzest/validator/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
91
91
  palimpzest/validator/validator.py,sha256=SvjK09zCpGtK0yM0OasvQlSzyq3loy32DyOOKRmYXC0,15977
92
- palimpzest-1.2.0.dist-info/licenses/LICENSE,sha256=5GUlHy9lr-Py9kvV38FF1m3yy3NqM18fefuE9wkWumo,1079
93
- palimpzest-1.2.0.dist-info/METADATA,sha256=IKxg8RllEvn6dgboEJVnxdnd5RwYmXFhIL2FHvoYpWw,5359
94
- palimpzest-1.2.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
95
- palimpzest-1.2.0.dist-info/top_level.txt,sha256=raV06dJUgohefUn3ZyJS2uqp_Y76EOLA9Y2e_fxt8Ew,11
96
- palimpzest-1.2.0.dist-info/RECORD,,
92
+ palimpzest-1.3.0.dist-info/licenses/LICENSE,sha256=5GUlHy9lr-Py9kvV38FF1m3yy3NqM18fefuE9wkWumo,1079
93
+ palimpzest-1.3.0.dist-info/METADATA,sha256=1VcCZTtJHg1ujb41-3QquXQLYaWtpCG9AHuvtrvJGvg,5395
94
+ palimpzest-1.3.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
95
+ palimpzest-1.3.0.dist-info/top_level.txt,sha256=raV06dJUgohefUn3ZyJS2uqp_Y76EOLA9Y2e_fxt8Ew,11
96
+ palimpzest-1.3.0.dist-info/RECORD,,