langroid 0.41.3__py3-none-any.whl → 0.41.5__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/embedding_models/models.py +17 -16
- langroid/language_models/model_info.py +13 -0
- langroid/vector_store/weaviatedb.py +13 -4
- {langroid-0.41.3.dist-info → langroid-0.41.5.dist-info}/METADATA +7 -5
- {langroid-0.41.3.dist-info → langroid-0.41.5.dist-info}/RECORD +7 -7
- {langroid-0.41.3.dist-info → langroid-0.41.5.dist-info}/WHEEL +0 -0
- {langroid-0.41.3.dist-info → langroid-0.41.5.dist-info}/licenses/LICENSE +0 -0
@@ -450,9 +450,9 @@ class LlamaCppServerEmbeddings(EmbeddingModel):
|
|
450
450
|
class GeminiEmbeddings(EmbeddingModel):
|
451
451
|
def __init__(self, config: GeminiEmbeddingsConfig = GeminiEmbeddingsConfig()):
|
452
452
|
try:
|
453
|
-
|
453
|
+
from google import genai
|
454
454
|
except ImportError as e:
|
455
|
-
raise LangroidImportError(extra="google-
|
455
|
+
raise LangroidImportError(extra="google-genai", error=str(e))
|
456
456
|
super().__init__()
|
457
457
|
self.config = config
|
458
458
|
load_dotenv()
|
@@ -464,29 +464,30 @@ class GeminiEmbeddings(EmbeddingModel):
|
|
464
464
|
GEMINI_API_KEY env variable must be set to use GeminiEmbeddings.
|
465
465
|
"""
|
466
466
|
)
|
467
|
-
genai.
|
468
|
-
self.client = genai
|
467
|
+
self.client = genai.Client(api_key=self.config.api_key)
|
469
468
|
|
470
469
|
def embedding_fn(self) -> Callable[[List[str]], Embeddings]:
|
471
470
|
return EmbeddingFunctionCallable(self, self.config.batch_size)
|
472
471
|
|
473
|
-
def generate_embeddings(self, texts: List[str]) ->
|
474
|
-
|
472
|
+
def generate_embeddings(self, texts: List[str]) -> List[List[float]]:
|
473
|
+
"""Generates embeddings for a list of input texts."""
|
474
|
+
all_embeddings: List[List[float]] = []
|
475
|
+
|
475
476
|
for batch in batched(texts, self.config.batch_size):
|
476
|
-
result = self.client.embed_content( # type: ignore[attr-defined]
|
477
|
+
result = self.client.models.embed_content( # type: ignore[attr-defined]
|
477
478
|
model=self.config.model_name,
|
478
|
-
|
479
|
-
task_type="RETRIEVAL_DOCUMENT",
|
479
|
+
contents=batch,
|
480
480
|
)
|
481
481
|
|
482
|
-
|
483
|
-
|
484
|
-
|
482
|
+
if not hasattr(result, "embeddings") or not isinstance(
|
483
|
+
result.embeddings, list
|
484
|
+
):
|
485
|
+
raise ValueError(
|
486
|
+
"Unexpected format for embeddings: missing or incorrect type"
|
487
|
+
)
|
485
488
|
|
486
|
-
|
487
|
-
|
488
|
-
else:
|
489
|
-
all_embeddings.append(embeddings)
|
489
|
+
# Extract .values from ContentEmbedding objects
|
490
|
+
all_embeddings.extend([emb.values for emb in result.embeddings])
|
490
491
|
|
491
492
|
return all_embeddings
|
492
493
|
|
@@ -64,6 +64,7 @@ class GeminiModel(ModelName):
|
|
64
64
|
GEMINI_1_5_FLASH_8B = "gemini/gemini-1.5-flash-8b"
|
65
65
|
GEMINI_1_5_PRO = "gemini/gemini-1.5-pro"
|
66
66
|
GEMINI_2_FLASH = "gemini/gemini-2.0-flash"
|
67
|
+
GEMINI_2_FLASH_LITE = "gemini/gemini-2.0-flash-lite-preview"
|
67
68
|
GEMINI_2_FLASH_THINKING = "gemini/gemini-2.0-flash-thinking-exp"
|
68
69
|
|
69
70
|
|
@@ -282,9 +283,21 @@ MODEL_INFO: Dict[str, ModelInfo] = {
|
|
282
283
|
provider=ModelProvider.GOOGLE,
|
283
284
|
context_length=1_056_768,
|
284
285
|
max_output_tokens=8192,
|
286
|
+
input_cost_per_million=0.10,
|
287
|
+
output_cost_per_million=0.40,
|
285
288
|
rename_params={"max_tokens": "max_completion_tokens"},
|
286
289
|
description="Gemini 2.0 Flash",
|
287
290
|
),
|
291
|
+
GeminiModel.GEMINI_2_FLASH_LITE.value: ModelInfo(
|
292
|
+
name=GeminiModel.GEMINI_2_FLASH_LITE.value,
|
293
|
+
provider=ModelProvider.GOOGLE,
|
294
|
+
context_length=1_056_768,
|
295
|
+
max_output_tokens=8192,
|
296
|
+
input_cost_per_million=0.075,
|
297
|
+
output_cost_per_million=0.30,
|
298
|
+
rename_params={"max_tokens": "max_completion_tokens"},
|
299
|
+
description="Gemini 2.0 Flash Lite Preview",
|
300
|
+
),
|
288
301
|
GeminiModel.GEMINI_1_5_FLASH.value: ModelInfo(
|
289
302
|
name=GeminiModel.GEMINI_1_5_FLASH.value,
|
290
303
|
provider=ModelProvider.GOOGLE,
|
@@ -45,6 +45,9 @@ class WeaviateDBConfig(VectorStoreConfig):
|
|
45
45
|
embedding: EmbeddingModelsConfig = OpenAIEmbeddingsConfig()
|
46
46
|
distance: str = VectorDistances.COSINE
|
47
47
|
cloud: bool = False
|
48
|
+
docker: bool = False
|
49
|
+
host: str = "127.0.0.1"
|
50
|
+
port: int = 8080
|
48
51
|
storage_path: str = ".weaviate_embedded/data"
|
49
52
|
|
50
53
|
|
@@ -55,11 +58,13 @@ class WeaviateDB(VectorStore):
|
|
55
58
|
raise LangroidImportError("weaviate", "weaviate")
|
56
59
|
self.config: WeaviateDBConfig = config
|
57
60
|
load_dotenv()
|
58
|
-
if
|
59
|
-
self.client = weaviate.
|
60
|
-
|
61
|
+
if self.config.docker:
|
62
|
+
self.client = weaviate.connect_to_local(
|
63
|
+
host=self.config.host,
|
64
|
+
port=self.config.port,
|
61
65
|
)
|
62
|
-
|
66
|
+
self.config.cloud = False
|
67
|
+
elif self.config.cloud:
|
63
68
|
key = os.getenv("WEAVIATE_API_KEY")
|
64
69
|
url = os.getenv("WEAVIATE_API_URL")
|
65
70
|
if url is None or key is None:
|
@@ -73,6 +78,10 @@ class WeaviateDB(VectorStore):
|
|
73
78
|
cluster_url=url,
|
74
79
|
auth_credentials=Auth.api_key(key),
|
75
80
|
)
|
81
|
+
else:
|
82
|
+
self.client = weaviate.connect_to_embedded(
|
83
|
+
version="latest", persistence_data_path=self.config.storage_path
|
84
|
+
)
|
76
85
|
|
77
86
|
if config.collection_name is not None:
|
78
87
|
WeaviateDB.validate_and_format_collection_name(config.collection_name)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: langroid
|
3
|
-
Version: 0.41.
|
3
|
+
Version: 0.41.5
|
4
4
|
Summary: Harness LLMs with Multi-Agent Programming
|
5
5
|
Author-email: Prasad Chalasani <pchalasani@gmail.com>
|
6
6
|
License: MIT
|
@@ -21,7 +21,7 @@ Requires-Dist: fakeredis<3.0.0,>=2.12.1
|
|
21
21
|
Requires-Dist: fire<1.0.0,>=0.5.0
|
22
22
|
Requires-Dist: gitpython<4.0.0,>=3.1.43
|
23
23
|
Requires-Dist: google-api-python-client<3.0.0,>=2.95.0
|
24
|
-
Requires-Dist: google-
|
24
|
+
Requires-Dist: google-genai>=1.0.0
|
25
25
|
Requires-Dist: groq<1.0.0,>=0.13.0
|
26
26
|
Requires-Dist: grpcio<2.0.0,>=1.62.1
|
27
27
|
Requires-Dist: halo<1.0.0,>=0.0.31
|
@@ -112,8 +112,10 @@ Provides-Extra: exa
|
|
112
112
|
Requires-Dist: exa-py>=1.8.7; extra == 'exa'
|
113
113
|
Provides-Extra: fastembed
|
114
114
|
Requires-Dist: fastembed<0.4.0,>=0.3.1; extra == 'fastembed'
|
115
|
+
Provides-Extra: google-genai
|
116
|
+
Requires-Dist: google-genai>=1.0.0; extra == 'google-genai'
|
115
117
|
Provides-Extra: google-generativeai
|
116
|
-
Requires-Dist: google-
|
118
|
+
Requires-Dist: google-genai>=1.0.0; extra == 'google-generativeai'
|
117
119
|
Provides-Extra: hf-embeddings
|
118
120
|
Requires-Dist: sentence-transformers<3.0.0,>=2.2.2; extra == 'hf-embeddings'
|
119
121
|
Requires-Dist: torch<3.0.0,>=2.0.0; extra == 'hf-embeddings'
|
@@ -319,7 +321,7 @@ teacher_task.run()
|
|
319
321
|
- **Jan 2025:**
|
320
322
|
- [0.36.0](https://github.com/langroid/langroid/releases/tag/0.36.0): Weaviate vector-db support (thanks @abab-dev).
|
321
323
|
- [0.35.0](https://github.com/langroid/langroid/releases/tag/0.35.0): Capture/Stream reasoning content from
|
322
|
-
Reasoning LLMs (e.g. DeepSeek, OpenAI o1) in addition to final answer.
|
324
|
+
Reasoning LLMs (e.g. DeepSeek-R1, OpenAI o1) in addition to final answer.
|
323
325
|
- [0.34.0](https://github.com/langroid/langroid/releases/tag/0.34.0): DocChatAgent
|
324
326
|
chunk enrichment to improve retrieval. (collaboration with @dfm88).
|
325
327
|
- [0.33.0](https://github.com/langroid/langroid/releases/tag/0.33.3) Move from Poetry to uv! (thanks @abab-dev).
|
@@ -627,7 +629,7 @@ For many practical scenarios, you may need additional optional dependencies:
|
|
627
629
|
- For "chat with databases", use the `db` extra:
|
628
630
|
```bash
|
629
631
|
pip install "langroid[db]"
|
630
|
-
|
632
|
+
```
|
631
633
|
- You can specify multiple extras by separating them with commas, e.g.:
|
632
634
|
```bash
|
633
635
|
pip install "langroid[doc-chat,db]"
|
@@ -59,7 +59,7 @@ langroid/cachedb/momento_cachedb.py,sha256=YEOJ62hEcV6iIeMr5aGgRYgWQqFYaej9gEDEc
|
|
59
59
|
langroid/cachedb/redis_cachedb.py,sha256=7kgnbf4b5CKsCrlL97mHWKvdvlLt8zgn7lc528jEpiE,5141
|
60
60
|
langroid/embedding_models/__init__.py,sha256=KyYxR3jDFUCfYjSuCL86qjAmrq6mXXjOT4lFNOKVj6Y,955
|
61
61
|
langroid/embedding_models/base.py,sha256=Ml7oA6PzQm0wZmIYn3fhF7dvZCi-amviWUwOeBegH3A,2562
|
62
|
-
langroid/embedding_models/models.py,sha256=
|
62
|
+
langroid/embedding_models/models.py,sha256=93rQjvcltGLDYbgT1TIW8PZiAbNPAvPAqxCLlLS9GAo,18955
|
63
63
|
langroid/embedding_models/remote_embeds.py,sha256=6_kjXByVbqhY9cGwl9R83ZcYC2km-nGieNNAo1McHaY,5151
|
64
64
|
langroid/embedding_models/protoc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
65
65
|
langroid/embedding_models/protoc/embeddings.proto,sha256=_O-SgFpTaylQeOTgSpxhEJ7CUw7PeCQQJLaPqpPYKJg,321
|
@@ -71,7 +71,7 @@ langroid/language_models/azure_openai.py,sha256=zNQzzsERxNestq-hFfQZbvTzK43G2vjR
|
|
71
71
|
langroid/language_models/base.py,sha256=is4l3x858tdPHbrJU2jxJXe2j9PCGb9kk_c5nyfShxs,26150
|
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=
|
74
|
+
langroid/language_models/model_info.py,sha256=GEIyfypSzuev6ZG81-nb8OhvSxH4PHQ_m5UhBAQ8kSA,11910
|
75
75
|
langroid/language_models/openai_gpt.py,sha256=aajZ3ZvGkwI-3QdsNWgJ4QSyGpnyXJ5n4p2fYGUmdo4,77317
|
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
|
@@ -127,8 +127,8 @@ langroid/vector_store/momento.py,sha256=xOaU7Hlyyn_5ihb0ARS5JHtmrKrTCt2IdRA-ioMM
|
|
127
127
|
langroid/vector_store/pineconedb.py,sha256=otxXZNaBKb9f_H75HTaU3lMHiaR2NUp5MqwLZXpEY9M,14994
|
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
|
-
langroid/vector_store/weaviatedb.py,sha256=
|
131
|
-
langroid-0.41.
|
132
|
-
langroid-0.41.
|
133
|
-
langroid-0.41.
|
134
|
-
langroid-0.41.
|
130
|
+
langroid/vector_store/weaviatedb.py,sha256=tjlqEtkwrhykelt-nbr2WIuHWJBuSAGjZuG6gsAMBsc,11753
|
131
|
+
langroid-0.41.5.dist-info/METADATA,sha256=Ii6nQYMNZlMmeJ27AVkt7m6d5useGfOXIunF3BAlVzI,61331
|
132
|
+
langroid-0.41.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
133
|
+
langroid-0.41.5.dist-info/licenses/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
|
134
|
+
langroid-0.41.5.dist-info/RECORD,,
|
File without changes
|
File without changes
|