Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assumes llm_config.yaml is present at the root of the project #8

Open
duskybomb opened this issue Aug 1, 2024 · 2 comments
Open

Assumes llm_config.yaml is present at the root of the project #8

duskybomb opened this issue Aug 1, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@duskybomb
Copy link
Contributor

I have code that looks like this:

import os
from chainlite import llm_generation_chain, load_config_from_file

current_dir = os.path.dirname(os.path.realpath(__file__))
load_config_from_file(os.path.join(current_dir, "llm_config.yaml"))

When I run it I get the following error:

  File "/home/usr/worksheets/worksheets/environment.py", line 14, in <module>
    from chainlite import llm_generation_chain, load_config_from_file
  File "/home/usr/.conda/envs/worksheets-chainlite/lib/python3.11/site-packages/chainlite/__init__.py", line 3, in <module>
    from .llm_config import (
  File "/home/usr/.conda/envs/worksheets-chainlite/lib/python3.11/site-packages/chainlite/llm_config.py", line 148, in <module>
    load_config_from_file("./llm_config.yaml")
  File "/home/usr/.conda/envs/worksheets-chainlite/lib/python3.11/site-packages/chainlite/llm_config.py", line 81, in load_config_from_file
    with open(config_file, "r") as config_file:
         ^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: './llm_config.yaml'

The library assumes that the project's root directory contains a ./llm_config.yaml file and tries to load it even if load_config_from_file() is used.

I believe the issue is L148 in llm_config.py, which hardcodes the config file path.

@duskybomb duskybomb added the bug Something isn't working label Aug 1, 2024
@duskybomb
Copy link
Contributor Author

@s-jse why do we need this line:

load_config_from_file("./llm_config.yaml")

This assumes that llm_config.yaml should always be present in the root. Can we just remove this line?

@s-jse
Copy link
Member

s-jse commented Oct 26, 2024

I put it there because some code bases don't have a good starting point to put load_config_from_file() in, such that it always gets loaded first. Any suggestions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants