langroid 0.59.2__py3-none-any.whl → 0.59.4__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.
@@ -74,10 +74,10 @@ class GeminiModel(ModelName):
74
74
  GEMINI_1_5_PRO = "gemini-1.5-pro"
75
75
  GEMINI_2_5_PRO = "gemini-2.5-pro"
76
76
  GEMINI_2_5_FLASH = "gemini-2.5-flash"
77
- GEMINI_2_5_FLASH_LITE_PREVIEW = "gemini-2.5-flash-lite-preview-06-17"
77
+ GEMINI_2_5_FLASH_LITE = "gemini-2.5-flash-lite"
78
78
  GEMINI_2_PRO = "gemini-2.0-pro-exp-02-05"
79
79
  GEMINI_2_FLASH = "gemini-2.0-flash"
80
- GEMINI_2_FLASH_LITE = "gemini-2.0-flash-lite-preview"
80
+ GEMINI_2_FLASH_LITE = "gemini-2.0-flash-lite"
81
81
  GEMINI_2_FLASH_THINKING = "gemini-2.0-flash-thinking-exp"
82
82
 
83
83
 
@@ -90,6 +90,9 @@ class OpenAI_API_ParamInfo(BaseModel):
90
90
  params: Dict[str, List[str]] = dict(
91
91
  reasoning_effort=[
92
92
  OpenAIChatModel.O3_MINI.value,
93
+ GeminiModel.GEMINI_2_5_PRO.value,
94
+ GeminiModel.GEMINI_2_5_FLASH.value,
95
+ GeminiModel.GEMINI_2_5_FLASH_LITE.value,
93
96
  ],
94
97
  )
95
98
  # model-specific params in extra_body
@@ -438,7 +441,7 @@ MODEL_INFO: Dict[str, ModelInfo] = {
438
441
  input_cost_per_million=0.075,
439
442
  output_cost_per_million=0.30,
440
443
  rename_params={"max_tokens": "max_completion_tokens"},
441
- description="Gemini 2.0 Flash Lite Preview",
444
+ description="Gemini 2.0 Flash Lite",
442
445
  ),
443
446
  GeminiModel.GEMINI_1_5_FLASH.value: ModelInfo(
444
447
  name=GeminiModel.GEMINI_1_5_FLASH.value,
@@ -503,8 +506,8 @@ MODEL_INFO: Dict[str, ModelInfo] = {
503
506
  rename_params={"max_tokens": "max_completion_tokens"},
504
507
  description="Gemini 2.5 Flash",
505
508
  ),
506
- GeminiModel.GEMINI_2_5_FLASH_LITE_PREVIEW.value: ModelInfo(
507
- name=GeminiModel.GEMINI_2_5_FLASH_LITE_PREVIEW.value,
509
+ GeminiModel.GEMINI_2_5_FLASH_LITE.value: ModelInfo(
510
+ name=GeminiModel.GEMINI_2_5_FLASH_LITE.value,
508
511
  provider=ModelProvider.GOOGLE,
509
512
  context_length=65_536,
510
513
  max_output_tokens=65_536,
@@ -512,7 +515,7 @@ MODEL_INFO: Dict[str, ModelInfo] = {
512
515
  cached_cost_per_million=0.025,
513
516
  output_cost_per_million=0.40,
514
517
  rename_params={"max_tokens": "max_completion_tokens"},
515
- description="Gemini 2.5 Flash Lite Preview",
518
+ description="Gemini 2.5 Flash Lite",
516
519
  ),
517
520
  }
518
521
 
@@ -215,7 +215,7 @@ class OpenAICallParams(BaseModel):
215
215
  top_p: float | None = None
216
216
  reasoning_effort: str | None = None # or "low" or "high" or "medium"
217
217
  top_logprobs: int | None = None # if int, requires logprobs=True
218
- n: int = 1 # how many completions to generate (n > 1 is NOT handled now)
218
+ n: int | None = None # how many completions to generate (n > 1 is NOT handled now)
219
219
  stop: str | List[str] | None = None # (list of) stop sequence(s)
220
220
  seed: int | None = None
221
221
  user: str | None = None # user id for tracking
@@ -323,37 +323,15 @@ class OpenAIGPTConfig(LLMConfig):
323
323
  self, *, update: Mapping[str, Any] | None = None, deep: bool = False
324
324
  ) -> "OpenAIGPTConfig":
325
325
  """
326
- Override model_copy to handle unpicklable fields properly.
326
+ Copy config while preserving nested model instances and subclasses.
327
327
 
328
- This preserves fields like http_client_factory during normal copying
329
- while still allowing exclusion for pickling operations.
328
+ Important: Avoid reconstructing via `model_dump` as that coerces nested
329
+ models to their annotated base types (dropping subclass-only fields).
330
+ Instead, defer to Pydantic's native `model_copy`, which keeps nested
331
+ `BaseModel` instances (and their concrete subclasses) intact.
330
332
  """
331
- # Save references to unpicklable fields
332
- http_client_factory = self.http_client_factory
333
- streamer = self.streamer
334
- streamer_async = self.streamer_async
335
-
336
- # Get the current model data, excluding problematic fields
337
- data = self.model_dump(
338
- exclude={"http_client_factory", "streamer", "streamer_async"}
339
- )
340
-
341
- # Apply any updates
342
- if update:
343
- data.update(update)
344
-
345
- # Create a new instance with the copied data
346
- new_instance = self.__class__(**data)
347
-
348
- # Restore the unpicklable fields if they weren't overridden by update
349
- if "http_client_factory" not in (update or {}):
350
- new_instance.http_client_factory = http_client_factory
351
- if "streamer" not in (update or {}):
352
- new_instance.streamer = streamer
353
- if "streamer_async" not in (update or {}):
354
- new_instance.streamer_async = streamer_async
355
-
356
- return new_instance
333
+ # Delegate to BaseSettings/BaseModel implementation to preserve types
334
+ return super().model_copy(update=update, deep=deep) # type: ignore[return-value]
357
335
 
358
336
  def _validate_litellm(self) -> None:
359
337
  """
@@ -441,8 +419,9 @@ class OpenAIGPT(LanguageModel):
441
419
  Args:
442
420
  config: configuration for openai-gpt model
443
421
  """
444
- # copy the config to avoid modifying the original
445
- config = config.model_copy()
422
+ # copy the config to avoid modifying the original; deep to decouple
423
+ # nested models while preserving their concrete subclasses
424
+ config = config.model_copy(deep=True)
446
425
  super().__init__(config)
447
426
  self.config: OpenAIGPTConfig = config
448
427
  # save original model name such as `provider/model` before
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: langroid
3
- Version: 0.59.2
3
+ Version: 0.59.4
4
4
  Summary: Harness LLMs with Multi-Agent Programming
5
5
  Author-email: Prasad Chalasani <pchalasani@gmail.com>
6
6
  License: MIT
@@ -77,8 +77,8 @@ langroid/language_models/base.py,sha256=uRi-XtQhsEBN702_lGepxlNQ0e8gaPgaXjULYn2r
77
77
  langroid/language_models/client_cache.py,sha256=c8tAUTKxbd-CVGRy9WPYhI1pLtarFWWwX6-qm4ZXaqk,9399
78
78
  langroid/language_models/config.py,sha256=rhEZ9Wwq42q1uW_-oRFbilJhIw1vYlTvYqIk_7pHiSY,397
79
79
  langroid/language_models/mock_lm.py,sha256=tA9JpURznsMZ59iRhFYMmaYQzAc0D0BT-PiJIV58sAk,4079
80
- langroid/language_models/model_info.py,sha256=5bq2CzBzNVBSixxxcbNQ1-VIdjBtmbdm5XP4_z5xM88,19236
81
- langroid/language_models/openai_gpt.py,sha256=K0SSRQYDBb_2ku9TPxGBStsimxBKw-EmmySuagqfgSs,94072
80
+ langroid/language_models/model_info.py,sha256=iJXNriyibD0S-7NbGoUgQWzotNRZ614AfadCtF3ernU,19321
81
+ langroid/language_models/openai_gpt.py,sha256=qz-KN8phkVglZ6GeqXDwW60Dr1--ZhhKdTEaXwftRZA,93543
82
82
  langroid/language_models/provider_params.py,sha256=upG4cBrX8fcvAo1g7fcsv-rBbsfypIqcDRRV9m1hohU,4846
83
83
  langroid/language_models/utils.py,sha256=n55Oe2_V_4VNGhytvPWLYC-0tFS07RTjN83KWl-p_MI,6032
84
84
  langroid/language_models/prompt_formatter/__init__.py,sha256=2-5cdE24XoFDhifOLl8yiscohil1ogbP1ECkYdBlBsk,372
@@ -139,7 +139,7 @@ langroid/vector_store/pineconedb.py,sha256=7V0Bkt4ZrOR3V90tdXvdFmyNGuww7SFdyPq7-
139
139
  langroid/vector_store/postgres.py,sha256=TY_VshimwFZglYgKYm7Qn1F-dCSL8GsXRTgmh7VTe9c,16110
140
140
  langroid/vector_store/qdrantdb.py,sha256=mqxMOrcLAQpl0opuL8vXhdIt6ppv2zYyAvddHZoEW0Y,19184
141
141
  langroid/vector_store/weaviatedb.py,sha256=BS95bxVKNYfQc9VPb85a1HlcgnXfAkgMzjydnjCgRHc,11853
142
- langroid-0.59.2.dist-info/METADATA,sha256=-v3j3a3T4jAnC6xg0S7SRUgUdg8T2L9y1hSmO5lSy4Q,66517
143
- langroid-0.59.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
144
- langroid-0.59.2.dist-info/licenses/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
145
- langroid-0.59.2.dist-info/RECORD,,
142
+ langroid-0.59.4.dist-info/METADATA,sha256=5sDrQS2lyGqbo7U02g4Um4SeaoI627fsA19LITqQcxg,66517
143
+ langroid-0.59.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
144
+ langroid-0.59.4.dist-info/licenses/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
145
+ langroid-0.59.4.dist-info/RECORD,,