From b9cdb4d26fadfc47fe4e24eb6a9ae68d1997cc8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=83=D1=80=20=D0=9A=D1=83=D0=B7=D0=B0?= =?UTF-8?q?=D1=85=D0=BC=D0=B5=D1=82=D0=BE=D0=B2?= Date: Wed, 1 Jul 2026 14:06:46 +0000 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B8=D1=82=D1=8C=20SO?= =?UTF-8?q?LUTION.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SOLUTION.md | 49 ------------------------------------------------- 1 file changed, 49 deletions(-) delete mode 100644 SOLUTION.md diff --git a/SOLUTION.md b/SOLUTION.md deleted file mode 100644 index f170903..0000000 --- a/SOLUTION.md +++ /dev/null @@ -1,49 +0,0 @@ -**What was implemented** -- Replaced all Qdrant usage with a lightweight ChromaDB wrapper (`src/chromadb_client.py`). -- Built an FAQ bot that loads documents from a JSON‑lines file, stores them in ChromaDB, and retrieves the top‑k most similar documents for each user query. -- Integrated a single MCP‑tool (`src/mcp_tool.py`) that returns the current UTC time. -- Added OpenAI function‑calling logic in `src/main.py` so the model can invoke the MCP‑tool when needed. - -**Why the main parts satisfy the requirements** -- The `ChromadbClient` uses `chromadb.Client` with `duckdb+parquet` persistence, ensuring no Qdrant code remains. -- `ask_question()` queries ChromaDB, builds a context from the hits, and sends it to GPT‑4o‑mini, fulfilling the FAQ‑bot functionality. -- Only one tool (`MCPTool`) is defined and registered in the function schema, meeting the “exactly one MCP‑tool” constraint. -- The bot runs from the command line, loads data only once, and gracefully handles missing environment variables, keeping the repository structure unchanged. - -**Short code excerpts** - -`src/chromadb_client.py` – client initialization -```python -self.client = chromadb.Client(Settings( - chroma_db_impl="duckdb+parquet", - persist_directory=persist_directory, -)) -self.collection = self.client.get_or_create_collection(name=collection_name) -``` - -`src/mcp_tool.py` – single MCP‑tool implementation -```python -class MCPTool: - name = "get_current_utc_time" - description = "Returns the current UTC datetime in ISO 8601 format." - def __call__(self, arguments: Dict[str, Any]) -> Dict[str, Any]: - now = datetime.datetime.utcnow().isoformat() + "Z" - return {"current_time": now} -``` - -`src/main.py` – function‑calling integration -```python -response = openai.ChatCompletion.create( - model="gpt-4o-mini", - messages=messages, - functions=[function_schema], - function_call="auto", -) -``` - -**Honest limitations** -- The bot loads all FAQ documents at startup; for very large datasets a more incremental approach would be preferable. -- Error handling is minimal – missing files or API failures simply print to stderr. -- No unit tests are included; the implementation is ready for manual verification. - -This solution meets all assignment constraints: ChromaDB is the sole vector store, only one MCP‑tool is used, and the bot’s logic is fully functional. \ No newline at end of file