MCPcopy Create free account
hub / github.com/AsyncFuncAI/deepwiki-open / call

Method call

api/rag.py:416–445  ·  view source on GitHub ↗

Process a query using RAG. Args: query: The user's query Returns: Tuple of (RAGAnswer, retrieved_documents)

(self, query: str, language: str = "en")

Source from the content-addressed store, hash-verified

414 raise
415
416 def call(self, query: str, language: str = "en") -> Tuple[List]:
417 """
418 Process a query using RAG.
419
420 Args:
421 query: The user's query
422
423 Returns:
424 Tuple of (RAGAnswer, retrieved_documents)
425 """
426 try:
427 retrieved_documents = self.retriever(query)
428
429 # Fill in the documents
430 retrieved_documents[0].documents = [
431 self.transformed_docs[doc_index]
432 for doc_index in retrieved_documents[0].doc_indices
433 ]
434
435 return retrieved_documents
436
437 except Exception as e:
438 logger.error(f"Error in RAG call: {str(e)}")
439
440 # Create error response
441 error_response = RAGAnswer(
442 rationale="Error occurred while processing the query.",
443 answer=f"I apologize, but I encountered an error while processing your question. Please try again or rephrase your question."
444 )
445 return error_response, []

Callers

nothing calls this directly

Calls 1

RAGAnswerClass · 0.85

Tested by

no test coverage detected