Module: OllamaChat::RAGHandling
- Included in:
- Chat
- Defined in:
- lib/ollama_chat/rag_handling.rb
Overview
A module that handles Retrieval-Augmented Generation (RAG) operations for the OllamaChat application.
This module provides functionality for managing collections, clearing and changing collections, listing collections, and renaming collections within the RAG system.
Instance Method Summary collapse
-
#switch_collection(other_collection = nil) { ... } ⇒ Object
Temporarily switches the RAG collection to the specified collection.
Instance Method Details
#switch_collection(other_collection = nil) { ... } ⇒ Object
Temporarily switches the RAG collection to the specified collection.
The current collection is stored and restored after the block is executed, ensuring the state remains consistent regardless of whether the block completes successfully or raises an error.
18 19 20 21 22 23 24 |
# File 'lib/ollama_chat/rag_handling.rb', line 18 def switch_collection(other_collection = nil) other_collection ||= collection old_collection, @documents.collection = collection, other_collection yield other_collection ensure @documents.collection = old_collection end |