-
Notifications
You must be signed in to change notification settings - Fork 537
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
75 additions
and
38 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
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
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 framework. | ||
|
||
```python | ||
# load the existing index | ||
storage_context = StorageContext.from_defaults(persist_dir=<mydir>) | ||
index = load_index_from_storage(storage_context) | ||
|
||
async def entrypoint(ctx: JobContext): | ||
... | ||
chat_engine = index.as_chat_engine(chat_mode=ChatMode.CONTEXT) | ||
assistant = VoicePipelineAgent( | ||
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) |