ruankie / ecrivai

Fully automated AI blog writer that uses LangChain and GPT type LLMs for topic selection and content generation
MIT License
69 stars 17 forks source link

Scheduled publish fails - ImportError: cannot import name 'tracing_enabled' from 'langchain_core.tracers.context' #10

Closed ruankie closed 10 months ago

ruankie commented 10 months ago

Overview

During the scheduled publish workflow, the Create blog post step fails with the following error message:

Run python ecrivai/ecrivai/add_blog.py --out-dir "content/posts"
Traceback (most recent call last):
  File "/home/runner/work/ecrivai-blog-hugo/ecrivai-blog-hugo/ecrivai/ecrivai/add_blog.py", line 6, in <module>
    from langchain.chains import LLMChain, SimpleSequentialChain
  File "/usr/share/miniconda/envs/ecrivai/lib/python3.12/site-packages/langchain/chains/__init__.py", line 20, in <module>
    from langchain.chains.api.base import APIChain
  File "/usr/share/miniconda/envs/ecrivai/lib/python3.12/site-packages/langchain/chains/api/base.py", line [11](https://github.com/ruankie/ecrivai-blog-hugo/actions/runs/7403998049/job/20151420379#step:6:12), in <module>
    from langchain.callbacks.manager import (
  File "/usr/share/miniconda/envs/ecrivai/lib/python3.[12](https://github.com/ruankie/ecrivai-blog-hugo/actions/runs/7403998049/job/20151420379#step:6:13)/site-packages/langchain/callbacks/__init__.py", line 45, in <module>
    from langchain_core.tracers.context import (
ImportError: cannot import name 'tracing_enabled' from 'langchain_core.tracers.context' (/usr/share/miniconda/envs/ecrivai/lib/python3.12/site-packages/langchain_core/tracers/context.py). Did you mean: 'tracing_v2_enabled'?
Error: Process completed with exit code 1.
ruankie commented 10 months ago

This error seems related to this issue in langchain-core. Rolling back to a previous version (0.1.4) seemed to solve the issue.

After checking the logs of the conda env setup step in the failed scheduled publish workflow, it is clear that langchain-core-0.1.5 was used. Rolling back to a previous version should do the trick.

ruankie commented 10 months ago

11 solved the issue. Closing.