-
Notifications
You must be signed in to change notification settings - Fork 183
Add support for artifact in llama-index-server #580
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
Merged
Merged
Changes from 21 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
be4550f
support artifact
leehuwuj ba29391
migrate poetry to uv
leehuwuj 629a179
fix ci
leehuwuj d787ecf
update ci
leehuwuj 630a76d
Refactor artifact generation tools by introducing separate CodeGenera…
leehuwuj 96d846f
enhance code
leehuwuj 11fa3bc
remove previous content from tool input
leehuwuj f85e913
fix test
leehuwuj 03ee8c3
bump chat ui
leehuwuj 2b27ebd
revert changes
leehuwuj 66636e5
remove dead code
leehuwuj ef56e1d
Add artifact workflows for code and document generation
leehuwuj 322f43d
remove app_writer workflow
leehuwuj 2c3ac6d
Refactor artifact workflow classes and UI event handling
leehuwuj f975b79
Use uv to release package
leehuwuj 4fdfca5
Refactor artifact workflows and UI components
leehuwuj 1ba5a26
move code
leehuwuj fbed55a
Merge remote-tracking branch 'origin/main' into lee/add-artifact
leehuwuj 9e42cf3
Merge remote-tracking branch 'origin/main' into lee/add-artifact
leehuwuj 872f238
sort artifact
leehuwuj e09de60
fix mypy
leehuwuj 11ae75d
fix adding custom route does not work
leehuwuj 51f70a9
fix mypy
leehuwuj 830b3e5
revert create-llama change
leehuwuj 484cb9c
disable e2e test for python package change
leehuwuj 88af75c
fix missing set memory
leehuwuj 6104c3d
remove include last artifact in the code
leehuwuj 2f17cdc
Add ArtifactEvent model and update workflows to use it
leehuwuj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
---|---|---|
|
@@ -22,41 +22,46 @@ jobs: | |
working-directory: ./python/llama-index-server | ||
if: | | ||
github.event_name == 'push' && | ||
!startsWith(github.ref, 'refs/heads/release/llama-index-server-v') | ||
!startsWith(github.ref, 'refs/heads/release/llama-index-server-v') && | ||
!contains(github.event.head_commit.message, 'Release: llama-index-server v') | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install uv | ||
uses: astral-sh/setup-uv@v5 | ||
with: | ||
enable-cache: true | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.11" | ||
|
||
- name: Install Poetry | ||
run: | | ||
curl -sSL https://install.python-poetry.org | python3 - | ||
|
||
- name: Install dependencies | ||
run: poetry install | ||
shell: bash | ||
run: uv sync --all-extras --dev | ||
|
||
- name: Setup Git | ||
run: | | ||
git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
git config --global user.name "github-actions[bot]" | ||
|
||
- name: Bump patch version | ||
shell: bash | ||
run: | | ||
poetry version patch | ||
uvx --from=toml-cli toml set --toml-path=pyproject.toml project.version $(uvx --from=toml-cli toml get --toml-path=pyproject.toml project.version | awk -F. '{$NF = $NF + 1;}1' OFS=.) | ||
git add pyproject.toml | ||
git commit -m "chore(release): bump version to $(poetry version -s)" | ||
git commit -m "chore(release): bump llama-index-server version to $(uvx --from=toml-cli toml get --toml-path=pyproject.toml project.version)" | ||
|
||
- name: Get current version | ||
id: get_version | ||
shell: bash | ||
run: | | ||
version=$(poetry version -s) | ||
version=$(uvx --from=toml-cli toml get --toml-path=pyproject.toml project.version) | ||
echo "current_version=${version}" >> "$GITHUB_OUTPUT" | ||
|
||
- name: Create Release PR | ||
|
@@ -91,31 +96,34 @@ jobs: | |
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install uv | ||
uses: astral-sh/setup-uv@v5 | ||
with: | ||
enable-cache: true | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.11" | ||
|
||
- name: Install Poetry | ||
run: | | ||
curl -sSL https://install.python-poetry.org | python3 - | ||
|
||
- name: Install dependencies | ||
run: poetry install | ||
shell: bash | ||
run: uv sync --all-extras | ||
|
||
- name: Get current version | ||
id: get_version | ||
shell: bash | ||
run: | | ||
version=$(poetry version -s) | ||
version=$(uvx --from=toml-cli toml get --toml-path=pyproject.toml project.version) | ||
echo "current_version=${version}" >> "$GITHUB_OUTPUT" | ||
|
||
- name: Build and publish to PyPI | ||
uses: JRubics/[email protected] | ||
with: | ||
python_version: "3.11" | ||
pypi_token: ${{ secrets.PYPI_TOKEN }} | ||
package_directory: "python/llama-index-server" | ||
poetry_install_options: "--without dev" | ||
- name: Build package | ||
shell: bash | ||
run: uv build --no-sources | ||
|
||
- name: Publish to PyPI | ||
shell: bash | ||
run: uv publish --token ${{ secrets.PYPI_TOKEN }} | ||
|
||
- name: Create GitHub Release | ||
uses: softprops/action-gh-release@v2 | ||
|
This file contains hidden or 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
6 changes: 0 additions & 6 deletions
6
packages/create-llama/templates/types/streaming/nextjs/app/components/ui/lib/utils.ts
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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,24 @@ | ||
# Python files | ||
**/__pycache__ | ||
**/build | ||
**/dist | ||
**/venv | ||
**/env | ||
**/llama-index-server.egg-info | ||
|
||
# Jupyter files | ||
**/*.ipynb | ||
|
||
# Pytest files | ||
**/pytest.ini | ||
**/pytest.ini | ||
|
||
# Pytest cache | ||
**/pytest_cache | ||
|
||
# Tools | ||
**/.ruff_cache | ||
**/.mypy_cache | ||
**/.pylint.d | ||
**/.pyrightconfig.json | ||
**/.ui |
This file contains hidden or 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,52 @@ | ||
# Artifacts App | ||
|
||
This guide explains how to set up and use the LlamaIndex server with the artifact workflow to write code or documents. | ||
|
||
## Prerequisites | ||
|
||
- [uv](https://github.com/astral-sh/uv) installed (a fast Python package manager and runner) | ||
- An OpenAI API key | ||
|
||
## Steps | ||
|
||
1. **Set the OpenAI API Key** | ||
|
||
Export your OpenAI API key as an environment variable: | ||
|
||
```sh | ||
export OPENAI_API_KEY=your_openai_api_key_here | ||
``` | ||
|
||
2. **Run the Server Using uv** | ||
|
||
Start the server with the following command: | ||
|
||
```sh | ||
uv run main.py | ||
``` | ||
|
||
This will launch the FastAPI server using the workflow defined in `main.py`. | ||
|
||
3. **Access the Application** | ||
|
||
Open your browser and go to: | ||
|
||
``` | ||
http://localhost:8000 | ||
``` | ||
|
||
You will see the LlamaIndex Artifact app UI, where you can interact with the workflow. | ||
|
||
## Notes | ||
|
||
- By default, the server uses the code artifact workflow. If you want to use the document artifact workflow, edit `main.py` and uncomment the following line: | ||
|
||
```python | ||
# from examples.artifact.document_workflow import ArtifactWorkflow | ||
``` | ||
|
||
and comment out the code workflow import. | ||
|
||
- The UI provides starter questions to help you get started, or you can enter your own requests. | ||
|
||
- The workflow will guide you through planning and generating code or documents based on your input. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.