langroid 0.59.3__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.
- langroid/language_models/openai_gpt.py +10 -31
- {langroid-0.59.3.dist-info → langroid-0.59.4.dist-info}/METADATA +1 -1
- {langroid-0.59.3.dist-info → langroid-0.59.4.dist-info}/RECORD +5 -5
- {langroid-0.59.3.dist-info → langroid-0.59.4.dist-info}/WHEEL +0 -0
- {langroid-0.59.3.dist-info → langroid-0.59.4.dist-info}/licenses/LICENSE +0 -0
@@ -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
|
-
|
326
|
+
Copy config while preserving nested model instances and subclasses.
|
327
327
|
|
328
|
-
|
329
|
-
|
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
|
-
#
|
332
|
-
|
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
|
-
|
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
|
@@ -78,7 +78,7 @@ langroid/language_models/client_cache.py,sha256=c8tAUTKxbd-CVGRy9WPYhI1pLtarFWWw
|
|
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
80
|
langroid/language_models/model_info.py,sha256=iJXNriyibD0S-7NbGoUgQWzotNRZ614AfadCtF3ernU,19321
|
81
|
-
langroid/language_models/openai_gpt.py,sha256=
|
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.
|
143
|
-
langroid-0.59.
|
144
|
-
langroid-0.59.
|
145
|
-
langroid-0.59.
|
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,,
|
File without changes
|
File without changes
|