MCPcopy Create free account
hub / github.com/AQ-MedAI/MedMemoryBench / __init__

Method __init__

methods/self_rag.py:174–185  ·  view source on GitHub ↗
(self, documents, temperature=0.7, top_k=3, model_name=None, embedding_model=None)

Source from the content-addressed store, hash-verified

172# Define main class
173class SelfRAG:
174 def __init__(self, documents, temperature=0.7, top_k=3, model_name=None, embedding_model=None):
175 self.vectorstore = encode_documents(documents=documents, embedding_model=embedding_model)
176 self.top_k = top_k
177 self.llm = _get_chat_openai(model_name or "gpt-4o-mini", temperature=temperature, max_tokens=1000)
178
179 # Create LLMChains for each step
180 self.retrieval_chain = retrieval_prompt | self.llm.with_structured_output(RetrievalResponse)
181 self.relevance_chain = relevance_prompt | self.llm.with_structured_output(RelevanceResponse)
182 self.generation_chain = generation_prompt | self.llm.with_structured_output(GenerationResponse)
183 self.support_chain = support_prompt | self.llm.with_structured_output(SupportResponse)
184 self.utility_chain = utility_prompt | self.llm.with_structured_output(UtilityResponse)
185 self.start_time = time.time()
186
187
188 def run(self, query):

Callers

nothing calls this directly

Calls 2

encode_documentsFunction · 0.85
_get_chat_openaiFunction · 0.85

Tested by

no test coverage detected