Skip to content

Commit

Permalink
Merge pull request #169 from SylphAI-Inc/main
Browse files Browse the repository at this point in the history
[V0.2.0.beta.1 Release]
  • Loading branch information
liyin2015 authored Aug 15, 2024
2 parents 0e93812 + fd07350 commit e2f0116
Show file tree
Hide file tree
Showing 284 changed files with 20,443 additions and 3,948 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ jobs:
pip install torch # manually install torch
# pip install transformers # manually install transformers
poetry show
poetry show lightrag
poetry show adalflow
- name: Build documentation using Makefile
run: |
Expand Down Expand Up @@ -78,4 +77,4 @@ jobs:
# pwd # Print the current working directory
# ls -l ./build/ # List files in the build directory
# cat ./source/conf.py # Display the Sphinx configuration file
# working-directory: ${{ github.workspace }}/docs/build
# working-directory: ${{ github.workspace }}/docs/build
6 changes: 3 additions & 3 deletions .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@ jobs:
- name: Install dependencies
run: |
cd lightrag
cd adalflow
poetry config virtualenvs.create false
poetry install
- name: Run tests with pytest
run: |
cd lightrag
cd adalflow
poetry run pytest
- name: Upload pytest results as an artifact (optional)
uses: actions/upload-artifact@v3 # Updated to the latest version
if: always() # Always run this step to ensure test results are saved even if previous steps fail
with:
name: pytest-results
path: lightrag/.pytest_cache
path: adalflow/.pytest_cache
17 changes: 5 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,25 @@
test_llamaindex.py
outputs.txt
core/__pycache__
lightrag/__pycache__
adalflow/__pycache__
components/*/__pycache__
components/__pycache__
use_cases/__pycache__
*/__pycache__
tests/__pycache__
test_li.py
test_li*
dist/
li_test/
lib/
logs/
__pycache__/
# docs/source/
llama3/
docs/build/
docs/_build/
# docs/source/_templates
docs/source/documents/
# docs/source/apis/*
tests/log_test/*.log
lib/
li_test/
.mypy_cache/
.pytest_cache/
local_cache/
/*.txt
*.pth
data/
traces/
*.log
storage/
*.pkl
Expand All @@ -43,3 +32,7 @@ storage/
/*.svg
/*.csv
index.faiss
*.json
*.svg
# ignore the softlink to adalflow cache
*.adalflow
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ repos:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-added-large-files
args: ['--maxkb=1000']
- id: debug-statements
- id: detect-private-key

Expand Down
34 changes: 0 additions & 34 deletions .readthedocs.yaml

This file was deleted.

15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
</h4>

<p align="center">
<a href="https://pypi.org/project/lightRAG">
<img alt="PyPI Version" src="https://img.shields.io/pypi/v/lightRAG?style=flat-square">
<a href="https://pypi.org/project/adalflow/">
<img alt="PyPI Version" src="https://img.shields.io/pypi/v/adalflow?style=flat-square">
</a>
<a href="https://star-history.com/#SylphAI-Inc/LightRAG">
<img alt="GitHub stars" src="https://img.shields.io/github/stars/SylphAI-Inc/LightRAG?style=flat-square">
Expand Down Expand Up @@ -55,14 +55,13 @@

<h1>
<p align="center">
AdalFlow: The Library for Large Language Model Applications
AdalFlow: The Library for LLM Applications
</p>
</h1>

AdalFlow helps developers build and optimize LLM task pipelines.
Embracing similar design pattern to PyTorch, AdalFlow is light, modular, and robust, with a 100% readable codebase.

Note: We are in the progress of renaming to adalflow from lightrag.

# AdalFlow: A Tribute to Ada Lovelace

Expand Down Expand Up @@ -119,9 +118,9 @@ This leverages our two and only powerful base classes: `Component` as building b

from dataclasses import dataclass, field

from lightrag.core import Component, Generator, DataClass
from lightrag.components.model_client import GroqAPIClient
from lightrag.components.output_parsers import JsonOutputParser
from adalflow.core import Component, Generator, DataClass
from adalflow.components.model_client import GroqAPIClient
from adalflow.components.output_parsers import JsonOutputParser

@dataclass
class QAOutput(DataClass):
Expand Down Expand Up @@ -283,7 +282,7 @@ self.generator = Generator(
Install AdalFlow with pip:

```bash
pip install lightrag
pip install adalflow
```

Please refer to the [full installation guide](https://lightrag.sylph.ai/get_started/installation.html) for more details.
Expand Down
1 change: 0 additions & 1 deletion _lightrag/lightrag/__init__.py

This file was deleted.

3 changes: 3 additions & 0 deletions adalflow/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
tests/log
*.png
*.svg
21 changes: 20 additions & 1 deletion lightrag/CHANGELOG.md → adalflow/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
## [0.2.0.beta.1] - 2024-08-14
### Added
- Optimizer: `paramter`, `GradComponent`, `Optimizer`, `AdalComponent`, and `Trainer`.

### Added features
1. ``DataClass``
* support ``__input_fields__``, ``get_input_fields``, ``set_input_fields__``, along with the output version.
* Support ``Parameter`` field which will be converted to `p.data``.
* Support ``include`` besides of ``exclude``, they cant coexist.
* ``to_dict`` made sure the ordering of fields is rearranged according to the ``input_fields`` and ``output_fields``.

## [0.1.0-beta.6] - 2024-07-23

Rename the `lightrag` package to `adalflow`.

### Fixed

- We introduced a bug in the previous release, the ollama model client non-streaming call was not working. We fixed it as we cannot put yield and return in the same function.

## [0.1.0-beta.5] - 2024-07-23

### Fixed
Expand Down Expand Up @@ -31,7 +50,7 @@

### Added
- `Sequential` adds `acall` method.
- Add extra packages so that users can install them with `pip install lightrag[extra]`.
- Add extra packages so that users can install them with `pip install adalflow[extra]`.

## [0.0.0-beta.1] - 2024-07-10

Expand Down
3 changes: 3 additions & 0 deletions adalflow/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## poetry

use `poetry lock --no-update` to not update the version of the dependencies in the lock file.
File renamed without changes.
File renamed without changes.
11 changes: 5 additions & 6 deletions lightrag/README.md → adalflow/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,13 @@

<h1>
<p align="center">
AdalFlow: The Library for Large Language Model Applications
AdalFlow: The Library for LLM Applications
</p>
</h1>

AdalFlow helps developers build and optimize LLM task pipelines.
Embracing similar design pattern to PyTorch, AdalFlow is light, modular, and robust, with a 100% readable codebase.

Note: We are in the progress of renaming to adalflow from lightrag.

# AdalFlow: A Tribute to Ada Lovelace

Expand Down Expand Up @@ -119,9 +118,9 @@ This leverages our two and only powerful base classes: `Component` as building b

from dataclasses import dataclass, field

from lightrag.core import Component, Generator, DataClass
from lightrag.components.model_client import GroqAPIClient
from lightrag.components.output_parsers import JsonOutputParser
from adalflow.core import Component, Generator, DataClass
from adalflow.components.model_client import GroqAPIClient
from adalflow.components.output_parsers import JsonOutputParser

@dataclass
class QAOutput(DataClass):
Expand Down Expand Up @@ -283,7 +282,7 @@ self.generator = Generator(
Install AdalFlow with pip:

```bash
pip install lightrag
pip install adalflow
```

Please refer to the [full installation guide](https://lightrag.sylph.ai/get_started/installation.html) for more details.
Expand Down
80 changes: 80 additions & 0 deletions adalflow/adalflow/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
__version__ = "0.1.0-beta.6"

from adalflow.core.component import Component, fun_to_component

# from adalflow.core.container import Sequential
from adalflow.optim.grad_component import GradComponent
from adalflow.core.generator import Generator
from adalflow.core.types import GeneratorOutput, EmbedderOutput, RetrieverOutput
from adalflow.core.model_client import ModelClient
from adalflow.core.embedder import Embedder
from adalflow.core.string_parser import (
YamlParser,
JsonParser,
IntParser,
FloatParser,
ListParser,
BooleanParser,
)
from adalflow.components.output_parsers import (
YamlOutputParser,
JsonOutputParser,
ListOutputParser,
)
from adalflow.components.output_parsers.dataclass_parser import DataClassParser
from adalflow.core.prompt_builder import Prompt
from adalflow.optim import (
Optimizer,
DemoOptimizer,
TextOptimizer,
Parameter,
AdalComponent,
Trainer,
BootstrapFewShot,
TGDOptimizer,
EvalFnToTextLoss,
LLMAsTextLoss,
)
from adalflow.optim.types import ParameterType
from adalflow.utils import setup_env, get_logger

__all__ = [
"Component",
"fun_to_component",
"GradComponent",
"ModelClient",
"Generator",
"Embedder",
"Parameter",
"AdalComponent",
"Trainer",
"BootstrapFewShot",
"TGDOptimizer",
"EvalFnToTextLoss",
"LLMAsTextLoss",
"setup_env",
"get_logger",
"Prompt",
# Parsers
"YamlParser",
"JsonParser",
"IntParser",
"FloatParser",
"ListParser",
"BooleanParser",
# Output Parsers with dataclass formatting
"YamlOutputParser",
"JsonOutputParser",
"ListOutputParser",
"DataClassParser",
# Types
"GeneratorOutput",
"EmbedderOutput",
"RetrieverOutput",
# Optimizer types
"Optimizer",
"DemoOptimizer",
"TextOptimizer",
# parameter types
"ParameterType",
]
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .react import DEFAULT_REACT_AGENT_SYSTEM_PROMPT, ReActAgent
from lightrag.utils.registry import EntityMapping
from adalflow.utils.registry import EntityMapping

__all__ = [
"ReActAgent",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@
import logging


from lightrag.core.generator import Generator
from lightrag.core.component import Component
from lightrag.core.func_tool import FunctionTool, AsyncCallable
from lightrag.core.tool_manager import ToolManager
from lightrag.components.output_parsers import JsonOutputParser
from lightrag.core.types import (
from adalflow.core.generator import Generator
from adalflow.core.component import Component
from adalflow.core.func_tool import FunctionTool, AsyncCallable
from adalflow.core.tool_manager import ToolManager
from adalflow.components.output_parsers import JsonOutputParser
from adalflow.core.types import (
StepOutput,
GeneratorOutput,
Function,
FunctionOutput,
FunctionExpression,
)
from lightrag.core.model_client import ModelClient
from lightrag.utils.logger import printc
from adalflow.core.model_client import ModelClient
from lighadalflowtrag.utils.logger import printc


log = logging.getLogger(__name__)
Expand Down Expand Up @@ -64,6 +64,7 @@
{# Step History #}
{% if step_history %}
<STEPS>
Your previous steps:
{% for history in step_history %}
Step {{ loop.index }}.
"Thought": "{{history.action.thought}}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from .text_splitter import TextSplitter
from .data_components import ToEmbeddings, RetrieverOutputToContextStr
from lightrag.utils.registry import EntityMapping
from adalflow.utils.registry import EntityMapping


__all__ = ["TextSplitter", "ToEmbeddings", "RetrieverOutputToContextStr"]
Expand Down
Loading

0 comments on commit e2f0116

Please sign in to comment.