C++ RAG integration and function calling#7
Merged
Conversation
- cpp/include/aichat/rag.h: public API for RAG store (chunk ingestion, cosine-similarity retrieval, context builder) - cpp/src/rag/rag.cpp: implementation using hash-projection feature vectors (FNV-1a, 1024-dim), L2-normalised TF, cosine similarity - cpp/include/aichat/function.h: public API for tool/function calling (registry, system-prompt injection, tool-call dispatch) - cpp/src/function/function.cpp: implementation with C-callback and shell-command (popen) backends; tool_call/tool_result XML protocol - cpp/tests/test_rag.cpp: 5 RAG tests - cpp/tests/test_function.cpp: 7 function-calling tests - cpp/CMakeLists.txt: add new source files - cpp/tests/CMakeLists.txt: register 12 new test cases - cpp/include/aichat.h: include new headers - CPP_IMPLEMENTATION_SUMMARY.md: mark RAG and function calling complete All 27 ctest cases pass (was 15, now 27). Agent-Logs-Url: https://github.com/9cog/aichat/sessions/36c9c42d-3853-438e-8742-ed9d5ba29821 Co-authored-by: drzo <15202748+drzo@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the two remaining near-term features in the C++ cognitive kernel: retrieval-augmented generation and LLM tool/function calling.
RAG (
cpp/src/rag/)rag_add_file()rag_build_context()returns a prompt-ready context block for direct injection beforellm_chat_completion()Function calling (
cpp/src/function/)popen-based shell-command backends<tool_call>{"name":"…","args":{…}}</tool_call>; dispatcher parses, invokes, and returns<tool_result>…</tool_result>for re-injectionTests
12 new ctest cases (5 RAG, 7 function); total suite goes from 15 → 27 passing.