-
Notifications
You must be signed in to change notification settings - Fork 357
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
Publish llama-index plugin #924
Merged
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d06af94
Publish llama-index plugin
davidzhao 830fa15
feedback
davidzhao 6068050
fix type check
davidzhao 684fb57
more types
davidzhao d91b1b3
skip tests on forks
davidzhao 1a8a7af
works
davidzhao 69526ae
improve test workflow
davidzhao 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 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,5 @@ | ||
--- | ||
"livekit-plugins-llama-index": patch | ||
--- | ||
|
||
Publish llama-index plugin |
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 |
---|---|---|
@@ -1,14 +1,36 @@ | ||
# LiveKit Plugins Minimal | ||
# LiveKit Plugins Llama Index | ||
|
||
This is a minimal example of a LiveKit plugin for Agents. | ||
Agent Framework plugin for using Llama Index. Currently supports [Query Engine](https://docs.llamaindex.ai/en/stable/module_guides/deploying/query_engine/) and [Chat Engine](https://docs.llamaindex.ai/en/stable/module_guides/deploying/chat_engines/). | ||
|
||
### Developer note | ||
## Install | ||
|
||
When copying this directory over to create a new `livekit-plugins` package, make sure it's nested within the `livekit-plugins` folder and that the `"name"` field in `package.json` follows the proper naming convention for CI: | ||
```bash | ||
pip install livekit-plugins-llama-index | ||
``` | ||
|
||
## Query Engine | ||
|
||
Query Engine is primarily used for RAG. See [example voice agent](https://github.com/livekit/agents/blob/main/examples/voice-pipeline-agent/llamaindex-rag/query_engine.py) | ||
|
||
## Chat Engine | ||
|
||
```json | ||
{ | ||
"name": "livekit-plugins-<name>", | ||
"private": true | ||
} | ||
Chat Engine can be used as an LLM within the frame work. | ||
|
||
```python | ||
# load the existing index | ||
storage_context = StorageContext.from_defaults(persist_dir=<mydir>) | ||
index = load_index_from_storage(storage_context) | ||
chat_engine = index.as_chat_engine(chat_mode=ChatMode.CONTEXT) | ||
|
||
async def entrypoint(ctx: JobContext): | ||
... | ||
assistant = VoicePipelineAgent( | ||
davidzhao marked this conversation as resolved.
Show resolved
Hide resolved
|
||
vad=silero.VAD.load(), | ||
stt=deepgram.STT(), | ||
llm=llama_index.LLM(chat_engine=chat_engine), | ||
tts=openai.TTS(), | ||
chat_ctx=initial_ctx, | ||
) | ||
``` | ||
|
||
full example [here](https://github.com/livekit/agents/blob/main/examples/voice-pipeline-agent/llamaindex-rag/chat_engine.py) |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ChatEngine isn't the recommended way tho. Since this one doesn't support function calls (It is using the LLM from lama_index)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one: https://github.com/livekit/agents/blob/main/examples/voice-pipeline-agent/llamaindex-rag/query_engine.py
and this one https://github.com/livekit/agents/blob/main/examples/voice-pipeline-agent/llamaindex-rag/retrieval.py
are more appropriate, but it depends on the needs.
The ChatEngine is also doing some "context" management (like keeping the previous rag search of the prior question etc.). They all have pros and cons
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, you have an example for it, I'm just documenting it. should we not point folks down that path?