Skip to content

Commit

Permalink
[Bug fix] Fix issues related to logging configuration (#1318)
Browse files Browse the repository at this point in the history
  • Loading branch information
deshraj committed Mar 14, 2024
1 parent ebdce87 commit 8520033
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 17 deletions.
1 change: 1 addition & 0 deletions embedchain/alembic.ini
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ keys = console
keys = generic

[logger_root]
level = WARN
handlers = console
qualname =

Expand Down
19 changes: 9 additions & 10 deletions embedchain/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@
import yaml
from tqdm import tqdm

from embedchain.cache import (Config, ExactMatchEvaluation,
SearchDistanceEvaluation, cache,
gptcache_data_manager, gptcache_pre_function)
from embedchain.cache import (
Config,
ExactMatchEvaluation,
SearchDistanceEvaluation,
cache,
gptcache_data_manager,
gptcache_pre_function,
)
from embedchain.client import Client
from embedchain.config import AppConfig, CacheConfig, ChunkerConfig
from embedchain.core.db.database import get_session, init_db, setup_engine
Expand All @@ -20,8 +25,7 @@
from embedchain.embedder.base import BaseEmbedder
from embedchain.embedder.openai import OpenAIEmbedder
from embedchain.evaluation.base import BaseMetric
from embedchain.evaluation.metrics import (AnswerRelevance, ContextRelevance,
Groundedness)
from embedchain.evaluation.metrics import AnswerRelevance, ContextRelevance, Groundedness
from embedchain.factory import EmbedderFactory, LlmFactory, VectorDBFactory
from embedchain.helpers.json_serializable import register_deserializable
from embedchain.llm.base import BaseLlm
Expand Down Expand Up @@ -83,12 +87,10 @@ def __init__(
if name and config:
raise Exception("Cannot provide both name and config. Please provide only one of them.")

logger.debug("4.0")
# Initialize the metadata db for the app
setup_engine(database_uri=os.environ.get("EMBEDCHAIN_DB_URI"))
init_db()

logger.debug("4.0")
self.auto_deploy = auto_deploy
# Store the dict config as an attribute to be able to send it
self.config_data = config_data if (config_data and validate_config(config_data)) else None
Expand Down Expand Up @@ -118,15 +120,13 @@ def __init__(
self.llm = llm or OpenAILlm()
self._init_db()

logger.debug("4.1")
# Session for the metadata db
self.db_session = get_session()

# If cache_config is provided, initializing the cache ...
if self.cache_config is not None:
self._init_cache()

logger.debug("4.2")
# Send anonymous telemetry
self._telemetry_props = {"class": self.__class__.__name__}
self.telemetry = AnonymousTelemetry(enabled=self.config.collect_metrics)
Expand Down Expand Up @@ -337,7 +337,6 @@ def from_config(
:return: An instance of the App class.
:rtype: App
"""
logger.debug("6")
# Backward compatibility for yaml_path
if yaml_path and not config_path:
config_path = yaml_path
Expand Down
6 changes: 0 additions & 6 deletions embedchain/migrations/env.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
from logging.config import fileConfig

from alembic import context
from sqlalchemy import engine_from_config, pool
Expand All @@ -10,11 +9,6 @@
# access to the values within the .ini file in use.
config = context.config

# Interpret the config file for Python logging.
# This line sets up loggers basically.
if config.config_file_name is not None:
fileConfig(config.config_file_name)

target_metadata = Base.metadata

# other values from the config, defined by the needs of env.py,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "embedchain"
version = "0.1.96"
version = "0.1.97"
description = "Simplest open source retrieval(RAG) framework"
authors = [
"Taranjeet Singh <taranjeet@embedchain.ai>",
Expand Down

0 comments on commit 8520033

Please sign in to comment.