Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@ junit.xml

# Project-Specific
/lettuce/tests/log
/lettuce/log
/lettuce/log
lettuce-ui/search-results.csv
9 changes: 9 additions & 0 deletions lettuce-ui/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Lettuce UI

A user interface for Lettuce, built with marimo.

To start the UI:
```bash
uv run lettuce-ui
```

2 changes: 1 addition & 1 deletion lettuce/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ENV UV_CACHE_DIR=/tmp/uv_cache \

WORKDIR /src
COPY pyproject.toml ./
RUN uv sync --no-dev --extra llama-cpu \
RUN uv sync --no-dev --extra azure\
&& rm -rf /tmp/uv_cache ~/.cache/pip \
&& uv pip uninstall torch \
&& uv pip install torch==2.7.1+cpu --index-url https://download.pytorch.org/whl/cpu
Expand Down
9 changes: 9 additions & 0 deletions lettuce/api.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import os
import secrets
import hashlib
from typing import Set

from fastapi import FastAPI, Depends, HTTPException, status
from fastapi.middleware.cors import CORSMiddleware
from fastapi.security import HTTPBearer, HTTPAuthorizationCredentials
from opentelemetry.instrumentation.fastapi import FastAPIInstrumentor

from routers import search_routes
from options.base_options import BaseOptions
import importlib.metadata
Expand All @@ -12,6 +16,9 @@

security = HTTPBearer()

if os.getenv("APPLICATIONINSIGHTS_CONNECTION_STRING"):
from azure.monitor.opentelemetry import configure_azure_monitor
configure_azure_monitor()

def hash_api_key(api_key: str):
"""Hash an API key for secure storage comparison."""
Expand Down Expand Up @@ -77,6 +84,8 @@ def verify_api_key(credentials: HTTPAuthorizationCredentials = Depends(security)
dependencies=[Depends(verify_api_key)]
)

FastAPIInstrumentor.instrument_app(app)

@app.get("/health")
def healthcheck() -> dict[str, str]:
"""
Expand Down
266 changes: 0 additions & 266 deletions lettuce/components/models.py

This file was deleted.

10 changes: 10 additions & 0 deletions lettuce/components/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from .connect import get_model, connect_to_ollama, connect_to_openai
from .local_models import get_local_weights, download_model_from_huggingface

__all__ = [
"get_model",
"connect_to_openai",
"connect_to_ollama",
"get_local_weights",
"download_model_from_huggingface"
]
Loading
Loading