- LLM prompts are inputs or queries that users can provide to elicit specific responses from a Large Language Model (LLM). Example: You are an AI assistant. Summarize this clinical document in 250 words
- Tools are functions used by agents for getting things done. Example: To find patient ID from name.
- Chains are tools that use LLM calls to get things done. Example: Answer a clinical question based on patient health record using RAG
- Agents uses an LLM to orchestrate Chains and Tools to acheive the overarching goal. Example: Answer a doctors question related to a patient. Find patient, get health record, generate embedding and generate answer
MEDPrompt is a collection of prompts, tools, chains and agents for medical applications. MEDPrompt also includes a collection of templates for using FHIR in LLM prompts (see below). User contributions are highly appreciated!
This repository includes templates for converting FHIR resources into a text representation that can be injected into an LLM prompt. Only relevant information is extracted from the resource with simple transformations using helper functions. 🚒See this example usage.
Clinical calculators are tools that help healthcare professionals make medical decisions by providing them with quick and easy access to various medical formulas, scores, and algorithms. Calculations performed by LLMs are not reliable. FHIR2Calculator performs calculations on data fields extracted from a FHIR bundle and outputs the results as plain text that can be injected into LLM prompts.
Tools are functions that Langchain agents can use to carry out tasks based on the tool description. Example usage:
from medprompt.tools import FhirPatientSearchTool
tools = [FhirPatientSearchTool()]
Documentation is in progress. Any help will be highly appreciated.
See Examples folder
- Observation
- FHIR Bundle More documentation and examples to follow..
pip install medprompt
pip install git+https://github.com/dermatologist/medprompt.git
from medprompt import MedPrompter
prompt = MedPrompter()
prompt.set_template(
template_name="fhir_search_oai_chat_v1.json")
print(prompt.get_template_variables())
messages = prompt.generate_prompt(
{"question": "Find Conditions for patient with first name John?"})
print(messages)
If you find this project useful, give us a star. It helps others discover the project.
- PR welcome
- Add templates in this folder as jinja2 or JSON.
- Follow the naming conventions in the folder.
- Add tools, chains and agents in the appropriately named folders.
- Add documentations here as a markdown file with the same name.
- Add a link in the index.md file.
- Please see CONTRIBUTING.md