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