Skip to content

Commit

Permalink
issue #4: llama index deployment design
Browse files Browse the repository at this point in the history
  • Loading branch information
k-allagbe committed Mar 20, 2024
1 parent 79a0fff commit 9164536
Show file tree
Hide file tree
Showing 15 changed files with 1,590 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Python 3 with Jupyter",
"image": "mcr.microsoft.com/devcontainers/python:3.11",
"postCreateCommand": "pip3 install --user -r requirements.txt && pip3 install --user -r document-search/requirements.txt",
"postCreateCommand": "pip3 install --user -r requirements.txt",
"customizations": {
"vscode": {
"extensions": [
Expand Down
42 changes: 27 additions & 15 deletions .env.template
Original file line number Diff line number Diff line change
@@ -1,32 +1,44 @@
# API Key for Azure OpenAI
API_KEY=
# Storage Account Connection String. Obtain this from your Azure Storage account
# in the Azure Portal under "Access keys".
STORAGE_ACCOUNT_CONN_STRING=

# Endpoint URL for Azure OpenAI
# API Key for Azure OpenAI. Same value for both. Get this from the Azure portal
# under your Azure OpenAI Service resource.
OPENAI_API_KEY=
AZURE_OPENAI_API_KEY=

# Endpoint URL for Azure OpenAI. Find this in the Overview section of your Azure
# OpenAI Service resource in the Azure portal.
AZURE_ENDPOINT=

# API Version for Azure OpenAI
API_VERSION=
# API Version for Azure OpenAI Check the Azure OpenAI documentation for the
# current API version
# OPENAI_API_VERSION=2023-07-01-preview

# Language Model for Azure OpenAI.
# LLM_MODEL=
# Language Model for Azure OpenAI. Specify the model you wish to use.
# LLM_MODEL=gpt-4

# Language Model Deployment Name for Azure OpenAI
# LLM_DEPLOYMENT_NAME=
# Language Model Deployment Name for Azure OpenAI If you have a custom
# deployment, specify its name here. Otherwise, leave commented
# LLM_DEPLOYMENT_NAME=ailab-llm

# Embedding Model for Azure OpenAI
# EMBED_MODEL=
# Embedding Model for Azure OpenAI Specify the embedding model you wish to use.
# Check Azure OpenAI documentation for available models
# EMBED_MODEL=ada

# Embedding Model Deployment Name for Azure OpenAI
# EMBED_DEPLOYMENT_NAME=
# Embedding Model Deployment Name for Azure OpenAI.
# EMBED_DEPLOYMENT_NAME=text-embedding-ada-002

# Database Connection Configuration
# Database Connection Configuration These details will be specific to your
# database. Obtain them from your database administrator or setup
DB_SCHEME=
DB_HOST=
DB_PORT=
DB_USER=
DB_PASSWORD=
DB_NAME=

# Table and Column for Querying the Database
# Table and Column for Querying the Database Specify the table and column you
# wish to query. This will depend on your database schema
# TABLE_NAME=
# COLUMN=
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,12 @@ venv/
ENV/
env.bak/
venv.bak/

# Index files
index/

# Pickle files
*.pkl

# OS specific
.DS_Store
Binary file added docs/img/components.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/deployment.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/search_sequence.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/startup_sequence.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions docs/puml/components.plantuml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@startuml components
left to right direction
interface REST

component "LlamaIndex API" as api {
package app as "flask app"
package LlamaIndex as "llamaIndex_db" {
package llama_index
}
}
app --> LlamaIndex: uses
REST -- api

folder Container as "Index folder" {
file doc as "default__vector_store.json"
file index as "docstore.json"
file vector as "graph_store.json"
file graph as "image__vector_store.json"
file image as "index_store.json"
}

llama_index --> Container : reads

@enduml
16 changes: 16 additions & 0 deletions docs/puml/deployment.plantuml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@startuml deployment
left to right direction
interface REST

cloud Azure {
node docker as "Docker container" {
component "LlamaIndex API" as api
}
database volume as "Docker Volume" {
folder Container as "Index folder"
}
}

REST -- api
api --> Container : reads
@enduml
19 changes: 19 additions & 0 deletions docs/puml/search_sequence.plantuml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@startuml search sequence

actor user
participant "app:Flask" as app
participant "config:Config" as config
participant ":VectorIndexRetriever" as retriever

user -> app: POST /search query_string
activate app
app -> config: get retriever
app -> retriever: retrieve with query_string
activate retriever
retriever --> app: nodes
deactivate retriever
app -> app: generate results from nodes
app --> user: results
deactivate app

@enduml
20 changes: 20 additions & 0 deletions docs/puml/startup_sequence.plantuml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
@startuml startup sequence

participant "App Creator" as creator

create ":StorageContext" as sc
creator -> sc: create with index_folder

create ":BaseIndex" as index
creator -> index: create with storage_context

create ":VectorIndexRetriever" as retriever
creator -> retriever: create with index

create ":Config" as conf
creator -> conf: create with retriever

create ":Flask" as app
creator -> app: create with config

@enduml
Loading

0 comments on commit 9164536

Please sign in to comment.