-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from GreenBitAI/feature/langchain_integration
Feature/langchain integration
- Loading branch information
Showing
48 changed files
with
65,226 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# GBX Langchain Demos | ||
|
||
## Overview | ||
|
||
GBX Langchain Demos showcase the integration of GBX language models with the Langchain framework, enabling powerful and flexible natural language processing capabilities. | ||
|
||
## Installation | ||
|
||
### Step 1: Install the gbx_lm Package | ||
|
||
```bash | ||
pip install gbx-lm | ||
``` | ||
|
||
### Step 2: Install Langchain Package | ||
|
||
```bash | ||
pip install langchain-core | ||
``` | ||
|
||
Ensure your system has Python3 and pip installed before proceeding. | ||
|
||
## Usage | ||
|
||
### Basic Example | ||
|
||
Here's a basic example of how to use the GBX Langchain integration: | ||
|
||
```python | ||
from gbx_lm.langchain import ChatGBX | ||
from gbx_lm.langchain import GBXPipeline | ||
|
||
llm = GBXPipeline.from_model_id( | ||
model_id="GreenBitAI/Llama-3-8B-layer-mix-bpw-4.0-mlx", | ||
) | ||
chat = ChatGBX(llm=llm) | ||
``` | ||
|
||
### Advanced Usage | ||
|
||
#### Using `from_model_id` with custom parameters: | ||
|
||
```python | ||
from gbx_lm.langchain import GBXPipeline | ||
|
||
pipe = GBXPipeline.from_model_id( | ||
model_id="GreenBitAI/Llama-3-8B-layer-mix-bpw-4.0-mlx", | ||
pipeline_kwargs={"max_tokens": 100, "temp": 0.7}, | ||
) | ||
``` | ||
|
||
#### Passing model and tokenizer directly: | ||
|
||
```python | ||
from gbx_lm.langchain import GBXPipeline | ||
from gbx_lm import load | ||
|
||
model_id = "GreenBitAI/Llama-3-8B-layer-mix-bpw-4.0-mlx" | ||
model, tokenizer = load(model_id) | ||
pipe = GBXPipeline(model=model, tokenizer=tokenizer) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from .gbx_pipeline import GBXPipeline | ||
from .chat_gbx import ChatGBX | ||
from .graph_transformer import SimpleGraphTransformer |
Oops, something went wrong.