Skip to content

Instantly share code, notes, and snippets.

View rpappalax's full-sized avatar

Richard Pappalardo rpappalax

  • Mozilla
  • Valencia, Spain
View GitHub Profile
@rpappalax
rpappalax / gist:473e9494d65f778d9dccfa458b0fe7aa
Created February 2, 2026 15:37
app/llm/gemini_client.py
from __future__ import annotations
from vertexai.preview.generative_models import GenerativeModel, Part
from app.common.config import Settings
from app.llm.vertex_init import init_vertex
def generate(
settings: Settings,
__pycache__
*.pyc
*.pyo
*.pyd
.Python
.venv
venv
.git
.pytest_cache
FROM python:3.11-slim
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
fastapi==0.115.0
uvicorn[standard]==0.30.6
google-cloud-bigquery==3.25.0
google-cloud-core==2.4.1
google-cloud-aiplatform==1.67.1
fastapi==0.115.0
uvicorn[standard]==0.30.6
google-cloud-bigquery==3.25.0
google-cloud-core==2.4.1
google-cloud-aiplatform==1.67.1
@rpappalax
rpappalax / gist:636d078ffcfe31d01c43d3e9240770e5
Created January 30, 2026 15:32
app/services/analyze_service.py
from __future__ import annotations
from vertexai.preview.generative_models import Part
from app.common.config import Settings
from app.llm.gemini_client import generate
from app.retrieval.retriever import Retriever
def build_augmented_prompt(prompt: str, *, top_notes: list[dict]) -> str:
@rpappalax
rpappalax / gist:1281f42603563830f8c993176e0242c3
Created January 30, 2026 15:32
app/storage/bigquery_repo.py
from __future__ import annotations
from typing import List
from google.cloud import bigquery
from app.common.config import Settings
from app.retrieval.types import Note
class BigQueryNotesRepository:
@rpappalax
rpappalax / gist:7da582dddbdec83da0933f6f2e890d3a
Created January 30, 2026 15:31
app/retrieval/python_cosine.py (bridge retriever)
from __future__ import annotations
import logging
from typing import List
from app.common.config import Settings
from app.llm.embeddings import embed_text
from app.retrieval.retriever import Retriever
from app.retrieval.types import Note
from app.retrieval.utils import cosine
@rpappalax
rpappalax / gist:866c524e305c70e096b0d6f8a9c1e38c
Created January 30, 2026 15:31
app/retrieval/retriever.py (interface)
from __future__ import annotations
from abc import ABC, abstractmethod
from typing import List
from app.retrieval.types import Note
class Retriever(ABC):
@abstractmethod
@rpappalax
rpappalax / gist:b100eadb68e42ccf85df27b82ddc2966
Created January 30, 2026 15:30
app/retrieval/retriever.py (interface)
from __future__ import annotations
from abc import ABC, abstractmethod
from typing import List
from app.retrieval.types import Note
class Retriever(ABC):
@abstractmethod