Skip to content

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

@duskybomb

Description

@duskybomb

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions