- Add detailed docstrings to AgentNode, BasicRecursionFilterNode, and DocumentChunkRecursionFilterNode for clarity and documentation. - Improve input validation and error handling in agent nodes. - Update .gitignore to cover more environment, config, and IDE files. - Refactor LiteLLMCustomEndpointProvider for custom API endpoints. - Add conditional imports and dummy functions for LightRAG when unavailable. - Update config.yaml to use environment variables for API keys and clarify usage. - Refine requirements.txt to avoid heavy LightRAG dependencies. - Add tests/__init__.py with test suite metadata; remove redundant test files. - Fix CustomDict import and model config handling in litellmnodes.py. - Improve chunk processing and recursion filter logic in agent nodes. - Update utils/__init__.py to include env_config.
20 lines
926 B
Python
Executable File
20 lines
926 B
Python
Executable File
from pydantic import BaseModel
|
|
|
|
class CustomDict(dict):
|
|
def every_value_str(self):
|
|
def convert_value(value):
|
|
if isinstance(value, dict):
|
|
# Recursively handle nested dicts
|
|
return {k: convert_value(v) for k, v in value.items()}
|
|
elif isinstance(value, (list, tuple)):
|
|
# Recursively handle lists and tuples
|
|
return type(value)(convert_value(v) for v in value)
|
|
elif isinstance(value, BaseModel):
|
|
# Convert Pydantic BaseModel to its dict and apply conversion
|
|
return {k: convert_value(v) for k, v in value.dict().items()}
|
|
else:
|
|
# Convert non-dict, non-list/tuple, non-BaseModel values to strings
|
|
return str(value)
|
|
|
|
# Apply the conversion to the dictionary's values
|
|
return {key: convert_value(value) for key, value in self.items()} |