langroid 0.42.8__tar.gz → 0.42.9__tar.gz
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-0.42.8 → langroid-0.42.9}/PKG-INFO +1 -1
- {langroid-0.42.8 → langroid-0.42.9}/langroid/language_models/openai_gpt.py +24 -21
- {langroid-0.42.8 → langroid-0.42.9}/pyproject.toml +1 -1
- {langroid-0.42.8 → langroid-0.42.9}/.gitignore +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/LICENSE +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/README.md +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/__init__.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/__init__.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/base.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/batch.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/callbacks/__init__.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/callbacks/chainlit.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/chat_agent.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/chat_document.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/openai_assistant.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/special/__init__.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/special/arangodb/__init__.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/special/arangodb/arangodb_agent.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/special/arangodb/system_messages.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/special/arangodb/tools.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/special/arangodb/utils.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/special/doc_chat_agent.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/special/lance_doc_chat_agent.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/special/lance_rag/__init__.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/special/lance_rag/critic_agent.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/special/lance_rag/lance_rag_task.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/special/lance_rag/query_planner_agent.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/special/lance_tools.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/special/neo4j/__init__.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/special/neo4j/csv_kg_chat.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/special/neo4j/neo4j_chat_agent.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/special/neo4j/system_messages.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/special/neo4j/tools.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/special/relevance_extractor_agent.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/special/retriever_agent.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/special/sql/__init__.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/special/sql/sql_chat_agent.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/special/sql/utils/__init__.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/special/sql/utils/description_extractors.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/special/sql/utils/populate_metadata.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/special/sql/utils/system_message.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/special/sql/utils/tools.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/special/table_chat_agent.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/task.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/tool_message.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/tools/__init__.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/tools/duckduckgo_search_tool.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/tools/exa_search_tool.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/tools/file_tools.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/tools/google_search_tool.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/tools/metaphor_search_tool.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/tools/orchestration.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/tools/recipient_tool.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/tools/retrieval_tool.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/tools/rewind_tool.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/tools/segment_extract_tool.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/tools/tavily_search_tool.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/agent/xml_tool_message.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/cachedb/__init__.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/cachedb/base.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/cachedb/momento_cachedb.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/cachedb/redis_cachedb.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/embedding_models/__init__.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/embedding_models/base.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/embedding_models/models.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/embedding_models/protoc/__init__.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/embedding_models/protoc/embeddings.proto +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/embedding_models/protoc/embeddings_pb2.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/embedding_models/protoc/embeddings_pb2.pyi +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/embedding_models/protoc/embeddings_pb2_grpc.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/embedding_models/remote_embeds.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/exceptions.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/language_models/__init__.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/language_models/azure_openai.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/language_models/base.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/language_models/config.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/language_models/mock_lm.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/language_models/model_info.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/language_models/prompt_formatter/__init__.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/language_models/prompt_formatter/base.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/language_models/prompt_formatter/hf_formatter.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/language_models/prompt_formatter/llama2_formatter.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/language_models/utils.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/mytypes.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/parsing/__init__.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/parsing/agent_chats.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/parsing/code_parser.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/parsing/document_parser.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/parsing/para_sentence_split.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/parsing/parse_json.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/parsing/parser.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/parsing/pdf_utils.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/parsing/repo_loader.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/parsing/routing.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/parsing/search.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/parsing/spider.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/parsing/table_loader.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/parsing/url_loader.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/parsing/urls.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/parsing/utils.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/parsing/web_search.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/prompts/__init__.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/prompts/dialog.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/prompts/prompts_config.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/prompts/templates.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/py.typed +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/pydantic_v1/__init__.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/pydantic_v1/main.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/utils/__init__.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/utils/algorithms/__init__.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/utils/algorithms/graph.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/utils/configuration.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/utils/constants.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/utils/git_utils.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/utils/globals.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/utils/logging.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/utils/object_registry.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/utils/output/__init__.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/utils/output/citations.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/utils/output/printing.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/utils/output/status.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/utils/pandas_utils.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/utils/pydantic_utils.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/utils/system.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/utils/types.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/vector_store/__init__.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/vector_store/base.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/vector_store/chromadb.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/vector_store/lancedb.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/vector_store/meilisearch.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/vector_store/pineconedb.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/vector_store/postgres.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/vector_store/qdrantdb.py +0 -0
- {langroid-0.42.8 → langroid-0.42.9}/langroid/vector_store/weaviatedb.py +0 -0
@@ -215,11 +215,20 @@ class OpenAIGPTConfig(LLMConfig):
|
|
215
215
|
(a) locally-served models behind an OpenAI-compatible API
|
216
216
|
(b) non-local models, using a proxy adaptor lib like litellm that provides
|
217
217
|
an OpenAI-compatible API.
|
218
|
-
We could rename this class to OpenAILikeConfig
|
218
|
+
(We could rename this class to OpenAILikeConfig, but we keep it as-is for now)
|
219
|
+
|
220
|
+
Important Note:
|
221
|
+
Due to the `env_prefix = "OPENAI_"` defined below,
|
222
|
+
all of the fields below can be set AND OVERRIDDEN via env vars,
|
223
|
+
# by upper-casing the name and prefixing with OPENAI_, e.g.
|
224
|
+
# OPENAI_MAX_OUTPUT_TOKENS=1000.
|
225
|
+
# If any of these is defined in this way in the environment
|
226
|
+
# (either via explicit setenv or export or via .env file + load_dotenv()),
|
227
|
+
# the environment variable takes precedence over the value in the config.
|
219
228
|
"""
|
220
229
|
|
221
230
|
type: str = "openai"
|
222
|
-
api_key: str = DUMMY_API_KEY
|
231
|
+
api_key: str = DUMMY_API_KEY
|
223
232
|
organization: str = ""
|
224
233
|
api_base: str | None = None # used for local or other non-OpenAI models
|
225
234
|
litellm: bool = False # use litellm api?
|
@@ -273,11 +282,6 @@ class OpenAIGPTConfig(LLMConfig):
|
|
273
282
|
|
274
283
|
super().__init__(**kwargs)
|
275
284
|
|
276
|
-
# all of the vars above can be set via env vars,
|
277
|
-
# by upper-casing the name and prefixing with OPENAI_, e.g.
|
278
|
-
# OPENAI_MAX_OUTPUT_TOKENS=1000.
|
279
|
-
# This is either done in the .env file, or via an explicit
|
280
|
-
# `export OPENAI_MAX_OUTPUT_TOKENS=1000` or `setenv OPENAI_MAX_OUTPUT_TOKENS 1000`
|
281
285
|
class Config:
|
282
286
|
env_prefix = "OPENAI_"
|
283
287
|
|
@@ -483,17 +487,10 @@ class OpenAIGPT(LanguageModel):
|
|
483
487
|
if self.config.use_completion_for_chat:
|
484
488
|
self.config.use_chat_for_completion = False
|
485
489
|
|
486
|
-
|
487
|
-
# an explicit `export OPENAI_API_KEY=xxx` or `setenv OPENAI_API_KEY xxx`
|
488
|
-
# Pydantic's BaseSettings will automatically pick it up from the
|
489
|
-
# .env file
|
490
|
-
# The config.api_key is ignored when not using an OpenAI model
|
490
|
+
self.api_key = config.api_key
|
491
491
|
if self.is_openai_completion_model() or self.is_openai_chat_model():
|
492
|
-
self.api_key = config.api_key
|
493
492
|
if self.api_key == DUMMY_API_KEY:
|
494
493
|
self.api_key = os.getenv("OPENAI_API_KEY", DUMMY_API_KEY)
|
495
|
-
else:
|
496
|
-
self.api_key = DUMMY_API_KEY
|
497
494
|
|
498
495
|
self.is_groq = self.config.chat_model.startswith("groq/")
|
499
496
|
self.is_cerebras = self.config.chat_model.startswith("cerebras/")
|
@@ -505,7 +502,8 @@ class OpenAIGPT(LanguageModel):
|
|
505
502
|
if self.is_groq:
|
506
503
|
# use groq-specific client
|
507
504
|
self.config.chat_model = self.config.chat_model.replace("groq/", "")
|
508
|
-
self.api_key
|
505
|
+
if self.api_key == DUMMY_API_KEY:
|
506
|
+
self.api_key = os.getenv("GROQ_API_KEY", DUMMY_API_KEY)
|
509
507
|
self.client = Groq(
|
510
508
|
api_key=self.api_key,
|
511
509
|
)
|
@@ -515,7 +513,8 @@ class OpenAIGPT(LanguageModel):
|
|
515
513
|
elif self.is_cerebras:
|
516
514
|
# use cerebras-specific client
|
517
515
|
self.config.chat_model = self.config.chat_model.replace("cerebras/", "")
|
518
|
-
self.api_key
|
516
|
+
if self.api_key == DUMMY_API_KEY:
|
517
|
+
self.api_key = os.getenv("CEREBRAS_API_KEY", DUMMY_API_KEY)
|
519
518
|
self.client = Cerebras(
|
520
519
|
api_key=self.api_key,
|
521
520
|
)
|
@@ -527,22 +526,26 @@ class OpenAIGPT(LanguageModel):
|
|
527
526
|
# in these cases, there's no specific client: OpenAI python client suffices
|
528
527
|
if self.is_gemini:
|
529
528
|
self.config.chat_model = self.config.chat_model.replace("gemini/", "")
|
530
|
-
self.api_key
|
529
|
+
if self.api_key == DUMMY_API_KEY:
|
530
|
+
self.api_key = os.getenv("GEMINI_API_KEY", DUMMY_API_KEY)
|
531
531
|
self.api_base = GEMINI_BASE_URL
|
532
532
|
elif self.is_glhf:
|
533
533
|
self.config.chat_model = self.config.chat_model.replace("glhf/", "")
|
534
|
-
self.api_key
|
534
|
+
if self.api_key == DUMMY_API_KEY:
|
535
|
+
self.api_key = os.getenv("GLHF_API_KEY", DUMMY_API_KEY)
|
535
536
|
self.api_base = GLHF_BASE_URL
|
536
537
|
elif self.is_openrouter:
|
537
538
|
self.config.chat_model = self.config.chat_model.replace(
|
538
539
|
"openrouter/", ""
|
539
540
|
)
|
540
|
-
self.api_key
|
541
|
+
if self.api_key == DUMMY_API_KEY:
|
542
|
+
self.api_key = os.getenv("OPENROUTER_API_KEY", DUMMY_API_KEY)
|
541
543
|
self.api_base = OPENROUTER_BASE_URL
|
542
544
|
elif self.is_deepseek:
|
543
545
|
self.config.chat_model = self.config.chat_model.replace("deepseek/", "")
|
544
546
|
self.api_base = DEEPSEEK_BASE_URL
|
545
|
-
self.api_key
|
547
|
+
if self.api_key == DUMMY_API_KEY:
|
548
|
+
self.api_key = os.getenv("DEEPSEEK_API_KEY", DUMMY_API_KEY)
|
546
549
|
|
547
550
|
self.client = OpenAI(
|
548
551
|
api_key=self.api_key,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{langroid-0.42.8 → langroid-0.42.9}/langroid/agent/special/sql/utils/description_extractors.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{langroid-0.42.8 → langroid-0.42.9}/langroid/language_models/prompt_formatter/hf_formatter.py
RENAMED
File without changes
|
{langroid-0.42.8 → langroid-0.42.9}/langroid/language_models/prompt_formatter/llama2_formatter.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|