Spaces:
Sleeping
Sleeping
Update pergunte_2.py
Browse files10 unmodified lines1112131415161718197 unmodified lines272829303132332 unmodified lines3637383940414210 unmodified lines# ======================================================================================# CONFIG VETOR (Mantendo a estrutura original do pergunte_2.py)# ======================================================================================PERSIST_DIR = "./chroma_rt"COLLECTION = "reforma_rt_irpfm"from langchain_openai import OpenAIEmbeddings, ChatOpenAIfrom langchain_chroma import Chroma7 unmodified lines# Cache global do Chroma_VDB = Nonedef load_vectordb() -> Chroma:"""Abre a base existente (sem reindexar) com cache global."""global _VDBif _VDB is None:_VDB = Chroma(2 unmodified linesembedding_function=emb,)return _VDB# ======================================================================================# CÁLCULOS / FERRAMENTAS (Integrando as ferramentas do pasted_content.txt)# ======================================================================================10 unmodified lines11121314151617181920212223247 unmodified lines3233343536372 unmodified lines40414243444510 unmodified lines# ======================================================================================# CONFIG VETOR (Mantendo a estrutura original do pergunte_2.py)# ======================================================================================from pathlib import Path# ================= CONFIG VETOR =================REPO_ROOT = Path(__file__).resolve().parentPERSIST_DIR = str((REPO_ROOT / "chroma_taxbot").resolve())PERSIST_DIR = os.getenv("CHROMA_DIR", PERSIST_DIR) # opcional, mesmo override do ingestorCOLLECTION = "taxbot_mem"from langchain_openai import OpenAIEmbeddings, ChatOpenAIfrom langchain_chroma import Chroma7 unmodified lines# Cache global do Chroma_VDB = Nonedef load_vectordb() -> Chroma:global _VDBif _VDB is None:_VDB = Chroma(2 unmodified linesembedding_function=emb,)return _VDB# ======================================================================================# CÁLCULOS / FERRAMENTAS (Integrando as ferramentas do pasted_content.txt)# ======================================================================================
pergunte_2.py+7-4