From 8a5ddae79abd5e660a5e4ee1a1ff76f499497f2d Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 1 Sep 2024 23:15:41 +0200 Subject: [PATCH] connect lancedb --- .pre-commit-config.yaml | 2 +- app.py | 8 +++++--- src/llm_api.py | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 68655202..809037d1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,7 +6,7 @@ repos: rev: v4.6.0 hooks: - id: check-added-large-files # Prevent giant files from being committed. - args: ['--maxkb=32000'] # default 500kb + args: ['--maxkb=600'] # default 500kb - id: check-ast # Simply check whether files parse as valid python. - id: check-json # Attempts to load all json files to verify syntax. - id: check-merge-conflict diff --git a/app.py b/app.py index d2c14f74..aaaf3a3c 100644 --- a/app.py +++ b/app.py @@ -8,10 +8,11 @@ - save user feedback & chat history into database """ -from typing import Any from collections.abc import Iterable +from typing import Any import streamlit as st +from lancedb.table import Table from PIL import Image import src.constants as cst @@ -19,6 +20,7 @@ from src.app_widgets import create_button, create_chat_msg, create_first_assistant_msg, show_chat_history, show_md_file from src.llm_api import build_full_llm_chat_input, stream_chat_response from src.prompt_building import WELCOME_MSG +from src.retrieval import get_knowledge_base # Chat Parameters # ----------------------------- @@ -103,8 +105,8 @@ def process_user_input(user_prompt: str, avatars: dict[str, Any], api_name: str, # Get Knowledge Base # ------------ init_st_keys("kbase_loaded", False) -# k_base: Table = get_knowledge_base() -# st.session_state["kbase_loaded"] = True +k_base: Table = get_knowledge_base() +st.session_state["kbase_loaded"] = True # Top Container diff --git a/src/llm_api.py b/src/llm_api.py index d699a005..55820b8b 100644 --- a/src/llm_api.py +++ b/src/llm_api.py @@ -1,5 +1,5 @@ -from typing import Any from collections.abc import Iterable +from typing import Any import requests import streamlit as st