langroid 0.41.0__py3-none-any.whl → 0.41.2__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/model_info.py +10 -3
- langroid/language_models/openai_gpt.py +32 -7
- langroid/parsing/url_loader.py +5 -1
- {langroid-0.41.0.dist-info → langroid-0.41.2.dist-info}/METADATA +3 -3
- {langroid-0.41.0.dist-info → langroid-0.41.2.dist-info}/RECORD +7 -7
- {langroid-0.41.0.dist-info → langroid-0.41.2.dist-info}/WHEEL +0 -0
- {langroid-0.41.0.dist-info → langroid-0.41.2.dist-info}/licenses/LICENSE +0 -0
@@ -320,8 +320,15 @@ MODEL_INFO: Dict[str, ModelInfo] = {
|
|
320
320
|
}
|
321
321
|
|
322
322
|
|
323
|
-
def get_model_info(
|
323
|
+
def get_model_info(
|
324
|
+
model: str | ModelName,
|
325
|
+
fallback_model: str | ModelName = "",
|
326
|
+
) -> ModelInfo:
|
324
327
|
"""Get model information by name or enum value"""
|
328
|
+
return _get_model_info(model) or _get_model_info(fallback_model) or ModelInfo()
|
329
|
+
|
330
|
+
|
331
|
+
def _get_model_info(model: str | ModelName) -> ModelInfo | None:
|
325
332
|
if isinstance(model, str):
|
326
|
-
return MODEL_INFO.get(model)
|
327
|
-
return MODEL_INFO.get(model.value)
|
333
|
+
return MODEL_INFO.get(model)
|
334
|
+
return MODEL_INFO.get(model.value)
|
@@ -468,7 +468,10 @@ class OpenAIGPT(LanguageModel):
|
|
468
468
|
self.supports_strict_tools = self.api_base is None
|
469
469
|
self.supports_json_schema = (
|
470
470
|
self.api_base is None
|
471
|
-
and get_model_info(
|
471
|
+
and get_model_info( # look for family/provider-specific then generic
|
472
|
+
self.chat_model_orig, # e.g. "gemini/gemini-2.0-flash"
|
473
|
+
self.config.chat_model, # e.g. "gemini-2.0-flash"
|
474
|
+
).has_structured_output
|
472
475
|
)
|
473
476
|
|
474
477
|
if settings.chat_model != "":
|
@@ -620,7 +623,10 @@ class OpenAIGPT(LanguageModel):
|
|
620
623
|
def supports_functions_or_tools(self) -> bool:
|
621
624
|
return (
|
622
625
|
self.is_openai_chat_model()
|
623
|
-
and get_model_info(
|
626
|
+
and get_model_info(
|
627
|
+
self.chat_model_orig,
|
628
|
+
self.config.chat_model,
|
629
|
+
).has_tools
|
624
630
|
)
|
625
631
|
|
626
632
|
def is_openai_completion_model(self) -> bool:
|
@@ -644,7 +650,10 @@ class OpenAIGPT(LanguageModel):
|
|
644
650
|
"""
|
645
651
|
List of params that are not supported by the current model
|
646
652
|
"""
|
647
|
-
model_info = get_model_info(
|
653
|
+
model_info = get_model_info(
|
654
|
+
self.chat_model_orig,
|
655
|
+
self.config.chat_model,
|
656
|
+
)
|
648
657
|
unsupported = set(model_info.unsupported_params)
|
649
658
|
for param, model_list in OpenAI_API_ParamInfo().params.items():
|
650
659
|
if (
|
@@ -659,7 +668,10 @@ class OpenAIGPT(LanguageModel):
|
|
659
668
|
Map of param name -> new name for specific models.
|
660
669
|
Currently main troublemaker is o1* series.
|
661
670
|
"""
|
662
|
-
return get_model_info(
|
671
|
+
return get_model_info(
|
672
|
+
self.chat_model_orig,
|
673
|
+
self.config.chat_model,
|
674
|
+
).rename_params
|
663
675
|
|
664
676
|
def chat_context_length(self) -> int:
|
665
677
|
"""
|
@@ -671,7 +683,12 @@ class OpenAIGPT(LanguageModel):
|
|
671
683
|
if self.config.use_completion_for_chat
|
672
684
|
else self.config.chat_model
|
673
685
|
)
|
674
|
-
|
686
|
+
orig_model = (
|
687
|
+
self.config.completion_model
|
688
|
+
if self.config.use_completion_for_chat
|
689
|
+
else self.chat_model_orig
|
690
|
+
)
|
691
|
+
return get_model_info(orig_model, model).context_length
|
675
692
|
|
676
693
|
def completion_context_length(self) -> int:
|
677
694
|
"""
|
@@ -683,7 +700,12 @@ class OpenAIGPT(LanguageModel):
|
|
683
700
|
if self.config.use_chat_for_completion
|
684
701
|
else self.config.completion_model
|
685
702
|
)
|
686
|
-
|
703
|
+
orig_model = (
|
704
|
+
self.chat_model_orig
|
705
|
+
if self.config.use_chat_for_completion
|
706
|
+
else self.config.completion_model
|
707
|
+
)
|
708
|
+
return get_model_info(orig_model, model).context_length
|
687
709
|
|
688
710
|
def chat_cost(self) -> Tuple[float, float]:
|
689
711
|
"""
|
@@ -709,7 +731,10 @@ class OpenAIGPT(LanguageModel):
|
|
709
731
|
return (
|
710
732
|
self.config.stream
|
711
733
|
and settings.stream
|
712
|
-
and get_model_info(
|
734
|
+
and get_model_info(
|
735
|
+
self.chat_model_orig,
|
736
|
+
self.config.chat_model,
|
737
|
+
).allows_streaming
|
713
738
|
and not settings.quiet
|
714
739
|
)
|
715
740
|
|
langroid/parsing/url_loader.py
CHANGED
@@ -68,7 +68,11 @@ class URLLoader:
|
|
68
68
|
docs.extend(new_chunks)
|
69
69
|
else:
|
70
70
|
# Try to detect content type and handle accordingly
|
71
|
-
|
71
|
+
try:
|
72
|
+
headers = requests.head(url).headers
|
73
|
+
except Exception as e:
|
74
|
+
logging.warning(f"Error getting headers for {url}: {e}")
|
75
|
+
headers = {}
|
72
76
|
content_type = headers.get("Content-Type", "").lower()
|
73
77
|
temp_file_suffix = None
|
74
78
|
if "application/pdf" in content_type:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: langroid
|
3
|
-
Version: 0.41.
|
3
|
+
Version: 0.41.2
|
4
4
|
Summary: Harness LLMs with Multi-Agent Programming
|
5
5
|
Author-email: Prasad Chalasani <pchalasani@gmail.com>
|
6
6
|
License: MIT
|
@@ -12,7 +12,7 @@ Requires-Dist: async-generator<2.0,>=1.10
|
|
12
12
|
Requires-Dist: bs4<1.0.0,>=0.0.1
|
13
13
|
Requires-Dist: cerebras-cloud-sdk<2.0.0,>=1.1.0
|
14
14
|
Requires-Dist: colorlog<7.0.0,>=6.7.0
|
15
|
-
Requires-Dist: docling<3.0.0,>=2.
|
15
|
+
Requires-Dist: docling<3.0.0,>=2.20.0
|
16
16
|
Requires-Dist: docstring-parser<1.0,>=0.16
|
17
17
|
Requires-Dist: duckduckgo-search<7.0.0,>=6.0.0
|
18
18
|
Requires-Dist: exa-py>=1.8.7
|
@@ -96,7 +96,7 @@ Requires-Dist: psycopg2<3.0.0,>=2.9.7; extra == 'db'
|
|
96
96
|
Requires-Dist: pymysql<2.0.0,>=1.1.0; extra == 'db'
|
97
97
|
Requires-Dist: sqlalchemy<3.0.0,>=2.0.19; extra == 'db'
|
98
98
|
Provides-Extra: doc-chat
|
99
|
-
Requires-Dist: docling<3.0.0,>=2.
|
99
|
+
Requires-Dist: docling<3.0.0,>=2.20.0; extra == 'doc-chat'
|
100
100
|
Requires-Dist: pdf2image<2.0.0,>=1.17.0; extra == 'doc-chat'
|
101
101
|
Requires-Dist: pymupdf4llm<0.1.0,>=0.0.17; extra == 'doc-chat'
|
102
102
|
Requires-Dist: pymupdf<2.0.0,>=1.23.3; extra == 'doc-chat'
|
@@ -71,8 +71,8 @@ langroid/language_models/azure_openai.py,sha256=zNQzzsERxNestq-hFfQZbvTzK43G2vjR
|
|
71
71
|
langroid/language_models/base.py,sha256=mN6HAjLgF2xpHObz5uPZ3JDID7jdTiRLEkoGgGrqLM8,25177
|
72
72
|
langroid/language_models/config.py,sha256=9Q8wk5a7RQr8LGMT_0WkpjY8S4ywK06SalVRjXlfCiI,378
|
73
73
|
langroid/language_models/mock_lm.py,sha256=5BgHKDVRWFbUwDT_PFgTZXz9-k8wJSA2e3PZmyDgQ1k,4022
|
74
|
-
langroid/language_models/model_info.py,sha256=
|
75
|
-
langroid/language_models/openai_gpt.py,sha256=
|
74
|
+
langroid/language_models/model_info.py,sha256=yKAaKoCanPoqaoHCzRVNPjg-M9a4S2Vm2AJGnwMeO-M,11360
|
75
|
+
langroid/language_models/openai_gpt.py,sha256=hC6knKQ9s9-bNixPWduxLRhLxs3y1zyfW7hU8oWWtHQ,78681
|
76
76
|
langroid/language_models/utils.py,sha256=L4_CbihDMTGcsg0TOG1Yd5JFEto46--h7CX_14m89sQ,5016
|
77
77
|
langroid/language_models/prompt_formatter/__init__.py,sha256=2-5cdE24XoFDhifOLl8yiscohil1ogbP1ECkYdBlBsk,372
|
78
78
|
langroid/language_models/prompt_formatter/base.py,sha256=eDS1sgRNZVnoajwV_ZIha6cba5Dt8xjgzdRbPITwx3Q,1221
|
@@ -91,7 +91,7 @@ langroid/parsing/routing.py,sha256=-FcnlqldzL4ZoxuDwXjQPNHgBe9F9-F4R6q7b_z9CvI,1
|
|
91
91
|
langroid/parsing/search.py,sha256=YPCwezM0c4PWbNUMEmQ5RrJBtvX4aWZ1CMCJFs4sqFo,9806
|
92
92
|
langroid/parsing/spider.py,sha256=hAVM6wxh1pQ0EN4tI5wMBtAjIk0T-xnpi-ZUzWybhos,3258
|
93
93
|
langroid/parsing/table_loader.py,sha256=qNM4obT_0Y4tjrxNBCNUYjKQ9oETCZ7FbolKBTcz-GM,3410
|
94
|
-
langroid/parsing/url_loader.py,sha256=
|
94
|
+
langroid/parsing/url_loader.py,sha256=MPJFhAdMl4LYVtL9f8r1BOtTkDOg2-hKkANUBUoXCG0,4846
|
95
95
|
langroid/parsing/urls.py,sha256=86omykgxo4hg2jyF10Ef-FJa9n6MgXdSXy2mImqgo5c,8076
|
96
96
|
langroid/parsing/utils.py,sha256=ZWMS7oG04GUY9EAIwnFN6KKo_ePCKhqk_H8jW6TDT0s,12805
|
97
97
|
langroid/parsing/web_search.py,sha256=wWSmV0METFTGPhHJIs-M4tog2Aur_75Pxr4a49cKDkU,7042
|
@@ -128,7 +128,7 @@ langroid/vector_store/pineconedb.py,sha256=otxXZNaBKb9f_H75HTaU3lMHiaR2NUp5MqwLZ
|
|
128
128
|
langroid/vector_store/postgres.py,sha256=DQHd6dt-OcV_QVNm-ymn28rlTfhI6hqgcpLTPCsm0jI,15990
|
129
129
|
langroid/vector_store/qdrantdb.py,sha256=v7TAsIoj_vxeKDYS9tpwJLBZA8fuTweTYxHo0X_uawM,17949
|
130
130
|
langroid/vector_store/weaviatedb.py,sha256=ONEr2iGS0Ii73oMe7tRk6bB-BEXQUa70fYSrdI8d3yo,11481
|
131
|
-
langroid-0.41.
|
132
|
-
langroid-0.41.
|
133
|
-
langroid-0.41.
|
134
|
-
langroid-0.41.
|
131
|
+
langroid-0.41.2.dist-info/METADATA,sha256=FWd7a2bi9c79wldH9KrVvq2U7Jtu_XeEWI9XcF17FpE,61259
|
132
|
+
langroid-0.41.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
133
|
+
langroid-0.41.2.dist-info/licenses/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
|
134
|
+
langroid-0.41.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|