-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fady/chains #9
Fady/chains #9
Conversation
dr_claude/chains/matcher.py
Outdated
class Symptom(pydantic.BaseModel): | ||
symptom: str | ||
present: bool | ||
retrievals: Optional[List[str]] = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI we already have a "Symptom" class in the codebase
dr_claude/chains/matcher.py
Outdated
def __init__( | ||
self, | ||
llm: LLM, | ||
symptom_extract_prompt: PromptTemplate, | ||
symptom_match_prompt: PromptTemplate, | ||
vectorstore: HuggingFAISS | ||
) -> None: | ||
self.symptom_extract_chain = LLMChain( | ||
llm=llm, | ||
prompt=symptom_extract_prompt, | ||
) | ||
symptom_match_chain = LLMChain( | ||
llm=llm, | ||
prompt=symptom_match_prompt, | ||
) | ||
self.stuff_retrievals_match_chain = StuffDocumentsChain( | ||
llm_chain=symptom_match_chain, | ||
document_variable_name="retrievals", | ||
verbose=True, | ||
callbacks=[], | ||
) | ||
self.retriever = vectorstore.as_retriever() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this init won't be compatible with the Pydantic superclass
dr_claude/chains/matcher.py
Outdated
def _call( | ||
self, | ||
inputs: Dict[str, Any], | ||
run_manager: Optional[CallbackManagerForChainRun] = None, | ||
) -> Dict[str, Any]: | ||
raw_symptom_extract = self.symptom_extract_chain(inputs) | ||
symptom_list = parse_raw_extract(raw_symptom_extract["text"]) | ||
for symptom in symptom_list.symptoms: # suboptimal but fine for now | ||
symptom.retrievals = self.retriever.get_relevant_documents(symptom.symptom) | ||
return self.run_matching_batch(symptom_list) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add an _acall too
dr_claude/chains/matcher.py
Outdated
texts: List[str], | ||
) -> "MatchingChain": | ||
anthropic = Anthropic( | ||
temperature=0.1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason for the 0.1?
dr_claude/chains/patient.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
empty file
No description provided.