Merge branch 'dev' into add_cli_options_superuser

This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-09-22 12:48:26 -03:00 • committed by GitHub
commit 6151052b18
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 1662 additions and 423 deletions

View file

@ -1,5 +1,6 @@
import ast
import inspect
import textwrap
from typing import Dict, Union
from langchain.agents.tools import Tool
@ -7,7 +8,7 @@ from loguru import logger
def get_func_tool_params(func, **kwargs) -> Union[Dict, None]:
tree = ast.parse(inspect.getsource(func))
tree = ast.parse(textwrap.dedent(inspect.getsource(func)))
# Iterate over the statements in the abstract syntax tree
for node in ast.walk(tree):
@ -58,13 +59,7 @@ def get_func_tool_params(func, **kwargs) -> Union[Dict, None]:
def get_class_tool_params(cls, **kwargs) -> Union[Dict, None]:
try:
tree = ast.parse(inspect.getsource(cls))
except IndentationError:
logger.error(
f"Error parsing class {cls.__name__}. Make sure there are no tabs in the code."
)
return None
tree = ast.parse(textwrap.dedent(inspect.getsource(cls)))
tool_params = {}

View file

@ -30,6 +30,7 @@ class LangfuseInstance:
cls._instance = Langfuse(
public_key=settings_manager.settings.LANGFUSE_PUBLIC_KEY,
secret_key=settings_manager.settings.LANGFUSE_SECRET_KEY,
host=settings_manager.settings.LANGFUSE_HOST,
)
else:
logger.debug("No Langfuse credentials found")