LUCI - Learning Useful Clinical Intelligence

The First AI-based Medical Agent Designed to Automate a Wide Range of Healthcare Processes

Introducing LUCI

LUCI is the first AI-based medical agent designed to automate a wide range of healthcare processes. LUCI also facilitates advanced tasks like generating master prompts that interconnect and enabling custom search queries for text or images, all with simple Python calls. It helps professionals handle everything from generating SOAP notes to performing agentic searches, assisting with GPT queries, and even creating personalized AI models.

LUCI is the first AI-based medical agent designed to automate a wide range of healthcare processes. LUCI also facilitates advanced tasks like generating master prompts that interconnect and enabling custom search queries for text or images, all with simple Python calls. It helps professionals handle everything from generating SOAP notes to performing agentic searches, assisting with GPT queries, and even creating personalized AI models.

LUCI is the first AI-based medical agent

Why was LUCI developed?

Easy to Code

Easy to Code

Luci is an AI-powered medical assistant designed for ease of coding by healthcare developers.

Agentic Search

Agentic Search

Performs both text and image searches using AI-powered agents. Users can search for medical information, images, or resources.

Voice-Enabled Agents

Voice-Enabled Agents

Includes agents that process voice inputs and can provide voice responses. This enhances user interaction by enabling hands-free operation.

Chain of Thoughts

Chain of Thoughts

Chain of Thoughts enhances the AI's decision-making transparency and reliability by providing detailed, step-by-step reasoning behind its responses.

Command Line Interface

Command Line Interface Tool

Users can perform tasks like generating SOAP notes, conducting medical literature searches, and interacting with AI agents directly from the command line

Security & Compliance

Security & Compliance

Strictly adhered to standard medical compliances, including HIPAA and FDA regulations, ensuring robust security protocols with no vulnerabilities.

Here we learn how to install LUCI in your terminal.

Before installing LUCI, make sure that you have already installed python and pip in your system. Sometimes, it is pip3 or pip, so use it as per your os requirement.

Copy Code Snippets
pip install LuciAI

Test the Installation:

Go to your terminal and type to check the installation.

Copy Code Snippets
pip show luciai

If it is installed successfully, it will show the details of the package like the below way.

Methods

Choose your model and find their respective methods!

Parameters Table
FUNCTION NAME METHOD TYPE
TOGETHER call_together ASYNC
OPENAI call_gpt SYNC
OPENAI call_async_gpt ASYNC
AZURE OPENAI call_azure ASYNC
AZURE OPENAI call_azure_sync SYNC

Description of Methods

  • call_together: Asynchronous method for interacting with the Together model.
  • call_gpt: Synchronous method for using the OpenAI GPT model.
  • call_async_gpt: Asynchronous method for using the OpenAI GPT model, allowing for non-blocking calls.
  • call_azure: Asynchronous method for accessing Azure’s OpenAI capabilities.
  • call_azure_sync: Synchronous method for interacting with Azure’s OpenAI services.

Feel free to choose the appropriate method based on your requirements and the model you are using!

Quick Start

Build your own medical agent by writing few lines of code.

Let’s do step by step. Here is the breakdown:

Import and setup of necessary modules and classes

Copy Code Snippet
from Luci import Agent, SearchTool
import os  # Import os to set environment variables

Under LUCI modules, there are different classes and methods. To use LUCI, you need to import these according to your requirements.

User-defined parameters

Copy Code Snippet
query = ""  # Final Query
model = ""  # Choose a model name
method = "call_together"  # Choose a ChatModel method (corrected)
email = "[email protected]" #use your email

You need to define these parameters for your agent. Remember before using any method, check the method list.

Set the API_KEY environment variable of the model

Copy Code Snippet
os.environ['API_KEY'] = ""

The API key should correspond to the chosen model (such as OpenAI, Azure OpenAI, or Together), we’ll introduce logic that checks the method being used and sets the relevant API keys accordingly. Additionally, for Azure OpenAI, we’ll need to set additional environment variables like API_VERSION and DEPLOYMENT_NAME.

Make a Research Agent

Copy Code Snippet
research_agent = Agent.built(
    name="ResearchAgent",
    objective="Gather the latest research on diabetes treatment guidelines.",
    task=query,  # The research task/query
    precautions="Do not hallucinate information; only use reputable medical journals and sources.",
    tool=SearchTool(email=email)
)

A research agent is built to search the latest topics based on pubmed and summarize the results in a well format.

Make a Writer Agent

Copy Code Snippet
writer = Agent.built(
    name="WriterAgent",
    objective="Compose a comprehensive summary based on the research findings.",
    task="Summarize the diabetes treatment guidelines based on the provided research.",
    precautions="Maintain medical accuracy and clarity.",
    tool=None  # No specific tool needed for writing
)

Based on the research! we need to prepare a writer agent which can meet your requirements.

Connect the Writer Agent to the Research Agent

Copy Code Snippet
research_agent.connect_agent('writer_agent', writer)

Generate the final answer using the connected Writer Agent

Copy Code Snippet
final_answer = research_agent.generate_final_answer(model, method, query)

print("Final Answer:")
print(final_answer)

This uses the Research Agent’s task as the query for the Writer Agent and prints the result finally.

Luci is a powerful AI-driven platform designed to enhance healthcare processes and medical operations. Below are the key features of Luci that are highly relevant in the medical field:

1. SOAP Notes Generation

Luci enables automated generation of SOAP notes (Subjective, Objective, Assessment, Plan) based on patient data, allowing healthcare professionals to focus more on patient care rather than manual documentation.

  • Feature Highlights:

    • Structured generation of SOAP notes
    • Customizable for specific cases and patients
    • Accurate and medically sound summaries
    • Integration with Electronic Health Record (EHR) systems
Copy Code Snippet
luci-cli soap --model "your_model" --api-key "your_api_key" --subjective "Patient symptoms" --objective "Doctor observations" --assessment "Diagnosis" --plan "Treatment plan"

2. Medical Research Agent​

Luci provides intelligent agents that can gather, analyze, and summarize medical research. This is particularly useful for healthcare professionals and researchers needing quick access to the latest guidelines and clinical studies.

Feature Highlights:

Real-time search for medical literature and research articles Summarization of findings from reputable medical journals Customizable queries for specific conditions, treatments, or drug research Integration with medical research databases

 

3. Medical Report Summarization​

Luci can be used to quickly summarize lengthy medical reports, such as lab results, diagnostic tests, and imaging studies, making it easier for physicians to review critical information.

Feature Highlights:

Automated summarization of lengthy reports Accurate extraction of key findings and data points Integration with hospital and clinic information systems (HIS)

 

4. Virtual Healthcare Assistant​

Luci can be deployed as a virtual healthcare assistant to help patients with common healthcare queries, appointment scheduling, and basic symptom checks.

Feature Highlights:

Conversational AI for answering patient questions Scheduling and appointment management Symptom checks and healthcare advice based on provided data Secure integration with patient health records

 

5. Risk Factor Assessment​

Luci helps healthcare professionals assess risk factors for diseases such as cardiovascular diseases or diabetes by analyzing patient history and lab results.

Feature Highlights:

Automated risk analysis based on patient data Customizable criteria for various medical conditions Provides risk scores for chronic diseases Suggests preventative measures based on risk factors

 

6. Medical Image Analysis Assistance​

With agentic search functionality, Luci can assist in analyzing medical images such as X-rays, CT scans, or MRIs, providing AI-driven insights to assist with diagnosis.

Feature Highlights:

AI-based analysis of medical images Search for relevant case studies or similar images Integration with radiology information systems (RIS)

 

Luci offers agent-based search functionality that allows healthcare professionals to search vast medical datasets, journals, and clinical trials efficiently.

Feature Highlights:

Intelligent search for medical datasets and journals Support for specific queries about diseases, drugs, or treatments Data filtering based on the latest clinical guidelines

 

8. Patient Risk Prediction Models​

Luci can implement predictive models that assess and predict patient risks based on their medical history, lab results, and family history.

Feature Highlights:

Predictive analytics based on patient data Early detection of potential medical issues Suggests personalized treatment plans based on risk assessments

 

10. Symptom and Diagnosis Assistance​

Luci’s AI-driven agents can help medical practitioners by analyzing symptoms and assisting in the diagnostic process, suggesting potential conditions based on patient inputs.

Feature Highlights:

Symptom analysis based on patient inputs Diagnosis suggestions with medical reasoning Integration with diagnostic support systems

 

11. Medication and Treatment Plan Generation​

Luci helps doctors create customized treatment plans and suggest appropriate medications based on patient diagnosis, medical history, and ongoing treatment.

Feature Highlights:

Tailored treatment plan suggestions Medication management based on patient health data Integration with pharmaceutical databases for drug interactions

 

12. Telemedicine Support​

Luci can be integrated into telemedicine platforms to assist doctors in remote consultations by automating documentation, summarization, and patient interaction during the virtual visit.

Feature Highlights:

Virtual consultation support with automated note-taking Remote patient monitoring and data analysis Telehealth integration for seamless patient care

Medical Search refers to the process of retrieving and synthesizing medical information from a wide range of sources, such as research papers, clinical trials, medical databases, and health-related websites. In the healthcare domain, accurate and timely access to relevant medical knowledge is crucial for diagnosis, treatment, and decision-making. With advancements in artificial intelligence (AI) and machine learning, AI-driven medical search has revolutionized the way healthcare professionals and researchers search for and utilize medical data.

Here you can learn how to use luci performing medical search. As per the rules of ERS and NCBI, you need to provide your email address which is stored to their database for performing any medical search.

Python Code for Performing Medical Search

Copy Code Snippet
from Luci.Agents.medica_search_agent import MedicalSearchAgent

email = "[email protected]"
max_results = 5
query = "diabetes treatment guidelines"

agent = MedicalSearchAgent(email=email, max_results=max_results)
articles = agent.search(query)
agent.print_results(articles)

The above python code performs the multi-contextual agentic search in pubmed and retrieves the important informations like peer-reviewed journal papers, import databases and clinical trial results.

Search image very precisely with luci.

Image Searching Using Agentic Search refers to an advanced method where AI agents autonomously perform image-based searches by understanding user queries, analyzing visual content, and retrieving relevant images from various sources.

Get the JSON Response

Copy Code Snippet
from Luci import search_images

query="Recent trends of AI?" # Define your query

print(search_images(query, max_results=3))

Here is the JSON responses. You can find image title, url and source.

Copy Code Snippet
[{'height': 2700, 'image': 'https://datasciencedojo.com/wp-content/uploads/emerging-AI-and-machine-learning-trends.png', 'source': 'Bing', 'thumbnail': 'https://tse4.mm.bing.net/th?id=OIP.6GePrr_X29tbbZN3y6KJKAHaHa&pid=Api', 'title': '2023 emerging AI and Machine Learning trends | Data Science Dojo', 'url': 'https://datasciencedojo.com/blog/ai-and-machine-learning-trends/', 'width': 2700}, {'height': 802, 'image': 'https://www.solulab.com/wp-content/uploads/2024/01/Top-Artificial-Intelligence-Trends-1200x802.jpg', 'source': 'Bing', 'thumbnail': 'https://tse2.mm.bing.net/th?id=OIP.hfnFtS_9eZ27UmYId8JwNwHaE8&pid=Api', 'title': 'Top Artificial Intelligence Trends | AI Trends', 'url': 'https://www.solulab.com/top-ai-trends-for-2024/', 'width': 1200}, {'height': 880, 'image': 'https://www.startus-insights.com/wp-content/uploads/2022/12/AI-trends-InnovationMap-StartUs-Insights-noresize.png', 'source': 'Bing', 'thumbnail': 'https://tse1.mm.bing.net/th?id=OIP._Jep5ulz0lEOxYq6Htu-LwHaFF&pid=Api', 'title': 'Top 10 AI Trends in 2023 | StartUs Insights', 'url': 'https://www.startus-insights.com/innovators-guide/ai-trends/', 'width': 1280}]

Get the Joined Response

Get the joined response in a precise manner and a structural format.

Here is the code, Let’s explain one by one.

Copy Code Snippet
from Luci import Search

query = "Revmaxx LLC"
search_instance = Search(query)

results = search_instance.search_images(max_results=2)
search_instance.print_img_result(results)

Import Search from luci and then mention query. Use search_images function and use print_img_result to print the results.

The result should come like this: –

Copy Code Snippet
Result 1:                                                                     
  Height: 500                                                                 
  Image: https://www.adproceed.com/wp-content/uploads/2024/04/401182-500x500.png
  Source: Bing
  Thumbnail: https://tse2.mm.bing.net/th?id=OIP.pNvB04G6-kjE0TjCGVEWfQHaHa&pid=Api
  Title: Unlock Free SOAP Note Generation from RevMaxx AI - Ad Proceed        
  Url: https://www.adproceed.com/ads/unlock-free-soap-note-generation-from-revmaxx-ai/
  Width: 500

Result 2:
  Height: 1080
  Image: https://media.licdn.com/dms/image/v2/D5622AQG1se2TP73iLg/feedshare-shrink_2048_1536/feedshare-shrink_2048_1536/0/1725684183008?e=2147483647&v=beta&t=lAx_XpFgsSOZMA-FEO17eNl_R7GTaeioUTMRfB29JXg
  Source: Bing
  Thumbnail: https://tse3.mm.bing.net/th?id=OIP.DOsI70eekNxElXFDqibyFQHaHa&pid=Api
  Title: RevMaxx on LinkedIn: Exciting News for RevMaxx! RevMaxx is thrilled to ...
  Url: https://www.linkedin.com/posts/revmaxx_exciting-news-for-revmaxx-revmaxx-is-thrilled-activity-7238044080797073408--1hr
  Width: 1080

Giving your model the ability to overcome the cut-off knowledge in order to obtain the most recent data. Let’s do search anything very precisely with luci agentic search mechanism.

Searching a text and get the precise answers. Here is the example –

Copy Code Snippet
from Luci import search_text

query="Recent trends of AI?" # Define your query

print(search_text(query, max_results=3))

Change the query as per your requirements. Here you get the json response like the below way. You can consider any object for your task and can easily modify it.

Copy Code Snippet
[{'body': 'In 2024, generative AI might actually become useful for the regular, non-tech person, and we are going to see more people tinkering with a million little AI models. State-of-the-art AI models ...', 'href': 'https://www.technologyreview.com/2024/01/04/1086046/whats-next-for-ai-in-2024/', 'title': "What's next for AI in 2024 | MIT Technology Review"}, {'body': "That's according to Stanford University's AI Index report. The report, which is in its seventh edition, covers trends such as technical advancements in AI, public perceptions of the technology and the geopolitical dynamics surrounding its development. Here are 10 key takeaways. 1. AI is outperforming humans on various tasks.", 'href': 'https://www.weforum.org/agenda/2024/04/stanford-university-ai-index-report/', 'title': "The current state of AI, according to Stanford's AI Index | World ..."}, {'body': 'Here are some important current AI trends to look out for in the coming year. Reality check: more realistic expectations. Multimodal AI. Small (er) language models and open source advancements. GPU shortages and cloud costs. Model optimization is getting more accessible. Customized local models and data pipelines.', 'href': 'https://www.ibm.com/think/insights/artificial-intelligence-trends', 'title': 'The Top Artificial Intelligence Trends - IBM'}]

Now you can understand, it is super easy to perform the agentic search using LUCI.

Search and Joined Response

If you want to make a joined response in the optimized way, use our print_text_result function.

Copy Code Snippet
from Luci import Search

query = "Revmaxx LLC" # Define your query
search_instance = Search(query)

results = search_instance.search_text(max_results=5)
search_instance.print_text_result(results)

You will see the result like the below format.

Copy Code Snippet
Result 1:
  Body: RevMaxx LLC Visit us on social media: Facebook X LinkedIn YouTube. RevMaxx AI Medical Scribe Revolutionizig 2024. Legal Disclaimer: EIN Presswire provides this news content "as is" without ...
  Href: https://fox59.com/business/press-releases/ein-presswire/741403346/revmaxx-introduces-customization-studio-for-its-ai-medical-scribe-to-enhance-specialized-clinical-documentation/
  Title: RevMaxx Introduces Customization Studio for Its AI Medical Scribe to ...

Result 2:
  Body: REVMAXX LLC is a Florida Domestic Limited-Liability Company filed on March 5, 2024. The company's filing status is listed as Active and its File Number is L24000113789. The Registered Agent on file for this company is Patel Alpesh and is located at 10845 Standing Stone Dr, Wimauma, FL 33598. The company's principal address is 10845 Standing ...
  Href: https://www.bizapedia.com/fl/revmaxx-llc.html
  Title: REVMAXX LLC in Wimauma, FL | Company Information & Reviews - Bizapedia

Now you can use this data to feed your model with the latest information. In the next section, we introduce the agentic image search function.

The luci-cli refined_agent command is used to create or define a refined AI agent within the Luci framework. This example demonstrates how to create an agent focused on building an open-source AI Medical Agent Framework, which can assist in a company specializing in AI medical scribing.

Copy Code Snippet
luci-cli refined_agent --name "Research" --objective "Building open source AI Medical Agent Framework how it can help my company focused on ai medical scribe" --precautions "Avoid using outdated information" --task "AI Medical Agent framework experience"

Luci CLI also allows users to run agents directly from a YAML configuration file, which can streamline the execution of tasks by predefining settings.

Copy Code Snippet
luci-cli run_agent --yaml-path "agents_configs/Research_research.yaml" --model "meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo" --method "call_together"

Explanation of Parameters:

--yaml-path: The path to the YAML configuration file where the agent’s parameters are stored.

Example: "agents_configs/Research_research.yaml" points to the configuration file for the Research agent.

--model: Specifies the model to use for the agent.

Example: "meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo" indicates the use of Meta Llama’s AI model.

--method: The method to call for the AI model. In this case, it refers to an asynchronous method.

Example: "call_together" uses the call_together method for interacting with the specified model.

The following command is used to generate SOAP notes using the LUCI CLI. It allows users to pass various parameters such as the model, API key, and specific SOAP note sections (Subjective, Objective, Assessment, Plan), along with a master prompt for generation.

Copy Code Snippet
luci-cli soap --model "your_model" --api-key "your_api_key" --subjective "..." --objective "..." --assessment "..." --plan "..." --master-prompt "..." --connected

You can switch between text and image searches, and toggle asynchronous mode by adding --async-mode.

Copy Code Snippet
luci-cli search "COVID-19 symptoms" --type text --async-mode --max-results 5
  • Change –type to text or image
  • If you choose asynchronous mode then add it --async-mode
  • If you want to use synchronous then remove it

Medical Search

Copy Code Snippet
luci-cli medsearch "diabetes treatment guidelines" --email "[email protected]"
 --max-results 2
  • Put query after medsearch what you want to search.
  • Write email after --email which is mandatory in ERS portal.

The Chain of Prompts (CoP) plays a crucial role in LUCI reasoning, especially those specialized in healthcare. CoP is a method where an AI agent solves complex tasks by breaking them into sequential, logical steps, often involving multiple prompts to guide its reasoning process. In healthcare, the accuracy and reliability of decision-making are important, and a well-structured chain of prompts ensures thoroughness and clarity in this process.

This Python script demonstrates how to use the LUCI package’s create_master_prompt function to generate a master prompt from a list of individual prompts. It enables information sharing between the prompts and activates search functionality.

Features​

  • Model Name: The script allows you to specify a model (e.g., "cerina").
  • Connected Prompts: By setting connected=True, information flows between the prompts, meaning earlier results can influence later prompts.
  • Search Integration: By enabling search=True, the agent can retrieve information via search queries during the prompt generation.

 

Code Explanation

Copy Code Snippet
import asyncio
from Luci import create_master_prompt

async def main():
    # Specify the model to be used for generating the master prompt
    model_name = "cerina" 
    
    # Define your list of prompts
    prompts = [
        "Generate the recent progress of revmaxx llc",
        "Explain the benefits of using AI in healthcare."
    ]

    # Generate master prompt using the standalone function
    master_prompt = await create_master_prompt(
        model_name=model_name,   # Model used for prompt generation
        prompts=prompts,         # List of individual prompts
        connected=True,          # Enable information sharing between prompts
        search=True              # Enable search functionality for retrieving external data
    )

    print("Generated Master Prompt:", master_prompt)

# Run the async main function
if __name__ == "__main__":
    asyncio.run(main())

Here we demonstrate how to use Luci’s SoapAgent class to generate a detailed SOAP note based on specific Subjective (S), Objective (O), Assessment (A), and Plan (P) inputs.

Features​

  • Model Name: The AI model used for generating SOAP notes is meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo.
  • Connected Prompts: The agent can pass information between the SOAP sections, ensuring coherent and accurate note generation.
  • SOAP Note Creation: The script handles patient information and generates SOAP notes using medical inputs.

 

Code Explanation

Copy Code Snippet
from Luci.Agents.soap import *  # Import all necessary components from Luci's SOAP module

# Define the model name and API key (replace with actual API key or pass from user input)
model_name = "meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo"
api_key = ""  # Replace with your API key

# SOAP note inputs
S = "Patient reports mild headache and fatigue."  # Subjective input
O = "Blood pressure is 120/80, heart rate is 75 bpm."  # Objective input
A = "Likely mild dehydration."  # Assessment input
P = "Recommend increasing fluid intake, rest, and monitor symptoms."  # Plan input
M = "Generate a detailed SOAP note based on the inputs."  # Master prompt for the SOAP note

# Create an instance of the SoapAgent class
soap_agent = SoapAgent(
    model_name=model_name,  # The model used for SOAP note generation
    api_key=api_key,        # The API key for accessing the model
    connected=True          # Enable information sharing across the SOAP sections
)

# Generate SOAP note using the inputs
soap_agent.create_soap(S, O, A, P, M)
Copy Code Snippet
from Luci import Agent, SearchTool
import os  # Import os to set environment variables

# User-defined parameters
query = "diabetes treatment guidelines"  # Final Query
model = "meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo"  # Choose a model name
method = "call_together"  # Choose a ChatModel method (corrected)
email = "[email protected]"

# Set the API_KEY environment variable
os.environ['API_KEY'] = ""

# Make a Research Agent
research_agent = Agent.built(
    name="ResearchAgent",
    objective="Gather the latest research on diabetes treatment guidelines.",
    task=query,  # The research task/query
    precautions="Do not hallucinate information; only use reputable medical journals and sources.",
    tool=SearchTool(email=email)
)

# Make a Writer Agent
writer = Agent.built(
    name="WriterAgent",
    objective="Compose a comprehensive summary based on the research findings.",
    task="Summarize the diabetes treatment guidelines based on the provided research.",
    precautions="Maintain medical accuracy and clarity.",
    tool=None  # No specific tool needed for writing
)

# Connect the Writer Agent to the Research Agent
research_agent.connect_agent('writer_agent', writer)

# Generate the final answer using the connected Writer Agent 
# This uses the Research Agent's task as the query for the Writer Agent
final_answer = research_agent.generate_final_answer(model, method, query)

print("Final Answer:")
print(final_answer)

RevMaxx is built to scale,
with 80%+ clinician adoption

Clinicians love RevMaxx AI Medical Scribe for its intuitive design, high accuracy, and customised note-taking capabilities. Powered by AI trained in medical specialities, it efficiently captures key insights, helping clinicians save valuable time and maintain work-life balance by finishing on schedule.

Try it now for FREE . Experience the difference.

Trusted By Healthcare Veterans

Join the growing number of healthcare providers transforming their operations with RevMaxx.