Skip to content

Commit

Permalink
Load configs from llm_config.yaml by default
Browse files Browse the repository at this point in the history
  • Loading branch information
s-jse committed May 27, 2024
1 parent 3c9416d commit 75b6a32
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 12 deletions.
21 changes: 12 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# chainlite
LangChain + LiteLLM that works

# ChainLite

ChainLite combines LangChain and LiteLLM to provide an easy-to-use and customizable interface for large language model applications.
<div class="title" style="text-align: center;">
<img src="assets/logo.png" alt="ChainLite Logo" style="width: 150px; height: auto;">
<h1>ChainLite</h1>
</div>
<div class="content">
<p>ChainLite combines LangChain and LiteLLM to provide an easy-to-use and customizable interface for large language model applications.</p>
<p style="font-size: smaller;"><sup>*</sup> Logo is generated using DALL·E 3.</p>
</div>


## Installation
Expand All @@ -17,14 +19,15 @@ To install ChainLite, use the following steps:
```


1. Copy `chainlite_config.yaml` to your project and follow the instructions there to update it with your own configuration.
1. Copy `llm_config.yaml` to your project and follow the instructions there to update it with your own configuration.

## Usage

Before you can use Chainlite, you need to call the following function to load the configuration file:
Before you can use Chainlite, you can call the following function to load the configuration file. If you don't, ChainLite will use `llm_config.yaml` in the current directory (the directory you are running your script from) by default.
```python
from chainlite import load_config_file
load_config_file("./chainlite_config.yaml") # The path should be relative to the directory you run the script from, usually the root directory of your project
load_config_file("./llm_config.yaml") # The path should be relative to the directory you run the script from, usually the root directory of your project
```
Make sure the corresponding API keys are set in environemnt variables with the name you specified in the configuration file, e.g. `OPENAI_API_KEY` etc.
Expand Down
Binary file added assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion chainlite/llm_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def load_config_from_file(config_file: str) -> None:
# this code is not safe to use with multiprocessing, only multithreading
thread_lock = threading.Lock()


load_config_from_file("./llm_config.yaml")
total_cost = 0.0 # in USD


Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name="chainlite",
version="0.1.9",
version="0.1.10",
author="Sina Semnani",
author_email="[email protected]",
description="A Python package that uses LangChain and LiteLLM to call large language model APIs easily",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_llm_generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
logger = get_logger(__name__)


load_config_from_file("./chainlite_config.yaml")
# load_config_from_file("./llm_config.yaml")

@pytest.mark.asyncio(scope="session")
async def test_llm_generate():
Expand Down

0 comments on commit 75b6a32

Please sign in to comment.