Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add multimodal retrieval #113

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@
.env.production.local

# devbox stuff
.devbox/*
.devbox/*

# python cache
__pycache__
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ build:
bun run build

dev:
docker-compose -p preprocessor -f ./preprocessor/docker-compose.yml up -d
bun dev

local-up: db
Expand All @@ -22,10 +23,11 @@ db-down-prune:
docker-compose -p chatbot_builder -f ./build/local/docker-compose.yml down --volumes

db-migrate:
bun drizzle-kit push:pg
bun drizzle-kit push

db-seed:
bun src/server/db/migration/seed.ts

lint-staged:
bun lint-staged

1 change: 1 addition & 0 deletions build/local/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ volumes:
networks:
default:
name: chatbot-builder-network
external: true
Binary file modified bun.lockb
Binary file not shown.
8 changes: 6 additions & 2 deletions drizzle.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ import { env } from '~/env'

export default {
schema: './src/server/db/migration/schema.ts',
driver: 'pg',
dialect: 'postgresql',
dbCredentials: {
connectionString: env.DATABASE_URL,
url: env.DATABASE_URL,
},
migrations: {
table: 'migrations',
schema: 'public',
},
// tablesFilter: ["chatbot-builder_*"],
out: './src/server/db/migrations',
Expand Down
12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
"@dwarvesf/react-hooks": "^0.8.2",
"@dwarvesf/react-utils": "^0.4.2",
"@hookform/resolvers": "^3.3.4",
"@langchain/community": "^0.2.3",
"@langchain/community": "^0.2.13",
"@langchain/core": "^0.2.9",
"@langchain/openai": "^0.2.0",
"@mochi-ui/core": "^0.14.3",
"@mochi-ui/icons": "^0.8.1",
"@mochi-ui/theme": "^0.20.1",
Expand All @@ -28,12 +30,14 @@
"@trpc/next": "next",
"@trpc/react-query": "next",
"@trpc/server": "next",
"@types/pg": "^8.11.6",
"@types/react-color": "^3.0.12",
"@vercel/blob": "^0.23.2",
"async": "^3.2.5",
"buffer": "^6.0.3",
"clsx": "^2.1.1",
"dayjs": "^1.11.11",
"drizzle-orm": "^0.29.4",
"drizzle-orm": "^0.31.0",
"fast-xml-parser": "^4.3.6",
"jsdom": "^24.0.0",
"langchain": "^0.2.2",
Expand All @@ -42,12 +46,14 @@
"next": "^14.1.3",
"next-auth": "^4.24.6",
"openai": "^4.42.0",
"pg": "^8.12.0",
"postgres": "^3.4.4",
"react": "18.2.0",
"react-color": "^2.19.3",
"react-dom": "18.2.0",
"react-dropzone": "^14.2.3",
"react-hook-form": "^7.51.3",
"sharp": "^0.33.4",
"superjson": "^2.2.1",
"tailwindcss-animate": "^1.0.7",
"use-debounce": "^10.0.1",
Expand All @@ -68,7 +74,7 @@
"@typescript-eslint/parser": "^7.1.1",
"cheerio": "^1.0.0-rc.12",
"domhandler": "^5.0.3",
"drizzle-kit": "^0.20.14",
"drizzle-kit": "^0.22.7",
"eslint": "^8.57.0",
"eslint-config-next": "^14.1.3",
"eslint-plugin-drizzle": "^0.2.3",
Expand Down
15 changes: 15 additions & 0 deletions preprocessor/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM python:3.12

WORKDIR /preprocessor

RUN apt-get update && apt-get install ffmpeg libsm6 libxext6 poppler-utils tesseract-ocr -y

COPY ./requirements.txt /preprocessor/requirements.txt

RUN pip install --no-cache-dir -r /preprocessor/requirements.txt

COPY . /preprocessor/

EXPOSE 80

CMD ["fastapi", "run", "main.py", "--port", "80"]
Empty file added preprocessor/app/__init__.py
Empty file.
Empty file.
11 changes: 11 additions & 0 deletions preprocessor/app/config/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import os

from dotenv import load_dotenv
from pydantic_settings import BaseSettings

load_dotenv()

class Settings(BaseSettings):
database_url: str =os.getenv("DATABASE_URL")

settings = Settings()
Empty file added preprocessor/app/db/__init__.py
Empty file.
19 changes: 19 additions & 0 deletions preprocessor/app/db/database.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from app.config.config import settings
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker

SQLALCHEMY_DATABASE_URL = settings.database_url

engine = create_engine(SQLALCHEMY_DATABASE_URL)

SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)

Base = declarative_base()

def get_db():
db = SessionLocal()
try:
yield db
finally:
db.close()
Empty file.
Loading