Skip to content
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

Merged
merged 11 commits into from
Jul 30, 2023
Merged

Fady/chains #9

merged 11 commits into from
Jul 30, 2023

Conversation

fadynakhla
Copy link
Owner

No description provided.

Comment on lines 16 to 19
class Symptom(pydantic.BaseModel):
symptom: str
present: bool
retrievals: Optional[List[str]] = None
Copy link
Collaborator

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

Comment on lines 28 to 49
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()
Copy link
Collaborator

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

Comment on lines 51 to 60
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)
Copy link
Collaborator

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

texts: List[str],
) -> "MatchingChain":
anthropic = Anthropic(
temperature=0.1,
Copy link
Collaborator

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?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

empty file

@fadynakhla fadynakhla merged commit 1e927b4 into master Jul 30, 2023
@fadynakhla fadynakhla deleted the fady/chains branch July 30, 2023 03:41
ArthurBook pushed a commit that referenced this pull request Aug 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants