Skip to content

Commit

Permalink
refactor(structure): modular, streaming enabled with django eventstre…
Browse files Browse the repository at this point in the history
…am, api change, runserver
  • Loading branch information
esteban-puerta-rs committed Dec 18, 2024
1 parent adbbcbd commit 48fad5c
Show file tree
Hide file tree
Showing 46 changed files with 1,166 additions and 1,044 deletions.
1 change: 1 addition & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def simple_vector(dir: str, metadata: dict = {}, *args, **kwargs):
)
return {"response": len(response["documents"])}


@kitchen.storage("simple-vector2")
def simple_vector2(dir: str, metadata: dict = {}, *args, **kwargs):
parser = Parser(api_key=os.environ.get("LLAMA_CLOUD_API_KEY", None))
Expand Down
41 changes: 36 additions & 5 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# This file is autogenerated by hatch-pip-compile with Python 3.11
#
# [constraints] requirements.txt (SHA256: bef74194f8fd80762a1ef00469312dbc8243a3854822b60f9150002d8d517687)
# [constraints] requirements.txt (SHA256: 18df5e1d5be84eeae244327525e84700b34a08f7506779624aa1f99fe146898d)
#
# - django-browser-reload
# - django-debug-toolbar
Expand Down Expand Up @@ -36,6 +36,7 @@
# - django-allauth[socialaccount]
# - django-anymail[resend]
# - django-compressor
# - django-eventstream
# - django-extensions
# - django-health-check
# - django-htmx
Expand All @@ -59,7 +60,7 @@
# - heroicons[django]
# - honcho
# - jupyterlab
# - kitchenai-python-sdk
# - kitchenai-python-sdk>=1.3.0
# - llama-index
# - llama-index-vector-stores-chroma
# - nbconvert
Expand Down Expand Up @@ -357,8 +358,10 @@ django==5.1.2
# django-compressor
# django-crispy-forms
# django-debug-toolbar
# django-eventstream
# django-extensions
# django-fastdev
# django-grip
# django-health-check
# django-htmx
# django-lifecycle
Expand Down Expand Up @@ -411,13 +414,21 @@ django-crispy-forms==2.3
# crispy-tailwind
django-debug-toolbar==4.4.6
# via hatch.envs.docs
django-eventstream==5.3.1
# via
# -c requirements.txt
# hatch.envs.docs
django-extensions==3.2.3
# via
# -c requirements.txt
# hatch.envs.docs
# dj-notebook
django-fastdev==1.12.0
# via hatch.envs.docs
django-grip==3.5.1
# via
# -c requirements.txt
# django-eventstream
django-health-check==3.18.3
# via
# -c requirements.txt
Expand Down Expand Up @@ -592,6 +603,11 @@ greenlet==3.1.1
# via
# -c requirements.txt
# sqlalchemy
gripcontrol==4.2.0
# via
# -c requirements.txt
# django-eventstream
# django-grip
grpcio==1.68.1
# via
# -c requirements.txt
Expand Down Expand Up @@ -826,7 +842,7 @@ jupyterlab-widgets==3.0.13
# via ipywidgets
keyring==25.4.1
# via hatch
kitchenai-python-sdk==1.1.0
kitchenai-python-sdk==1.3.0
# via
# -c requirements.txt
# hatch.envs.docs
Expand Down Expand Up @@ -1230,6 +1246,11 @@ ptyprocess==0.7.0
# -c requirements.txt
# pexpect
# terminado
pubcontrol==3.5.0
# via
# -c requirements.txt
# django-grip
# gripcontrol
pure-eval==0.2.3
# via
# -c requirements.txt
Expand Down Expand Up @@ -1282,6 +1303,9 @@ pyjwt==2.9.0
# via
# -c requirements.txt
# django-allauth
# django-eventstream
# gripcontrol
# pubcontrol
pypdf==5.1.0
# via
# -c requirements.txt
Expand Down Expand Up @@ -1393,6 +1417,7 @@ requests==2.32.3
# llama-index-core
# llama-index-legacy
# posthog
# pubcontrol
# requests-oauthlib
# sphinx
# tiktoken
Expand Down Expand Up @@ -1471,7 +1496,10 @@ six==1.16.0
# -c requirements.txt
# asttokens
# cssbeautifier
# django-eventstream
# django-grip
# django-pandas
# gripcontrol
# jsbeautifier
# kubernetes
# posthog
Expand Down Expand Up @@ -1759,8 +1787,11 @@ websockets==14.1
# -c requirements.txt
# sphinx-autobuild
# uvicorn
werkzeug==3.0.4
# via hatch.envs.docs
werkzeug==3.1.3
# via
# -c requirements.txt
# hatch.envs.docs
# django-grip
wheel==0.44.0
# via pip-tools
whitenoise==6.7.0
Expand Down
8 changes: 3 additions & 5 deletions kitchenai/api.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import logging

from django.apps import apps
from kitchenai.core.api import router as core_router
from ninja import NinjaAPI
from kitchenai.core.router import router as core_router

logger = logging.getLogger(__name__)

api = NinjaAPI(version="0.9.0")
api = NinjaAPI(version="0.10.0")


# Ensure `ready()` is called for all apps
apps.get_app_configs()

# Get the app's router from `MyAppConfig` and add it to the main API
api.add_router("/core", core_router) # Add app's router here
api.add_router("/v1", core_router)
Empty file.
4 changes: 1 addition & 3 deletions kitchenai/cli/client.py → kitchenai/cli/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,4 @@ def list_labels():
)
console.print(table)
except Exception as e:
console.print(f"[red]Error fetching labels: {e}[/red]")


console.print(f"[red]Error fetching labels: {e}[/red]")
Loading

0 comments on commit 48fad5c

Please sign in to comment.