agent-smith-ai
Project description
Agent Smith (AI)
Agent smith makes it easy to instantiate AI agents that can safely and easily call APIs and locally defined functions to interact with the world. It is currently designed to use OpenAI's function-calling models and thus requires an OpenAI API key.
Current features:
- Auto-summarization of conversations approaching the model's context window size.
- User messages are checked with OpenAI's moderations endpoint by default and rejected if toxic.
- Messages, including function call and result messages, are yielded to the caller in a stream.
- An optional token-bucket allows built-in rate-limiting.
- A basic, easy-to-deploy streamlit-based UI.
Basic Usage
Primary functionality is provided by a agent_smith_ai.utility_agent.UtilityAgent
class, which yields Message
objects in response to user questions. They also manage internal state chat, including the system prompt, chat history, token usage, and auto-summarization when the conversation length nears the context length. Finally, using OpenAI's function-calling models, they can register endpoints of REST API's, and locally defined methods and functions as callable functions.
Here's some code from the basic example in examples/monarch_basic.py
, which makes calls to a Monarch Initiative API. We start by using dotenv
to read a .env
file defining our OPENAI_API_KEY
environment variable
if present (we just need some way to access the key). We inherit from the UtilityAgent
class, defining a name and system
message for the agent.
from agent_smith_ai.utility_agent import UtilityAgent
import textwrap
import os
from typing import Any, Dict
# load environment variables from .env file
import dotenv
dotenv.load_dotenv()
## A UtilityAgent can call API endpoints and local methods
class MonarchAgent(UtilityAgent):
def __init__(self, name):
## define a system message
system_message = textwrap.dedent(f"""
You are the Monarch Assistant, an AI-powered chatbot that can answer questions about data from the Monarch Initiative knowledge graph.
You can search for entities such as genes, diseases, and phenotypes by name to get the associated ontology identifier.
You can retrieve associations between entities via their identifiers.
Users may use synonyms such as 'illness' or 'symptom'. Do not assume the user is familiar with biomedical terminology.
Always add additional information such as lay descriptions of phenotypes.
If the user changes the show function call setting, do not make any further function calls immediately.
IMPORTANT: Include markdown-formatted links to the Monarch Initiative for all results using the templates provided by function call responses.'.
""").strip()
Next in the constructor, we call the parent constructor which defines various agent properties.
super().__init__(name, # Name of the agent
system_message, # Openai system message
model = "gpt-3.5-turbo-0613", # Openai model name
openai_api_key = os.environ["OPENAI_API_KEY"], # API key; will default to OPENAI_API_KEY env variable
auto_summarize_buffer_tokens = 500, # Summarize and clear the history when fewer than this many tokens remains in the context window. Checked prior to each message sent to the model.
summarize_quietly = False, # If True, do not alert the user when a summarization occurs
max_tokens = None, # maximum number of tokens this agent can bank (default: None, no limit)
token_refill_rate = 10000.0 / 3600.0) # number of tokens to add to the bank per second
Still in the constructor, we can register some API endpoints for the agent to call. It is possible to register multiple APIs.
## register some API endpoints (inherited from UtilityAgent)
## the openapi.json spec must be available at the spec_url:
## callable endpoints must have a "description" and "operationId"
## params can be in body or query, but must be fully specified
self.register_api("monarch", # brief alphanumeric ID, used internally
spec_url = "https://oai-monarch-plugin.monarchinitiative.org/openapi.json",
base_url = "https://oai-monarch-plugin.monarchinitiative.org",
callable_endpoints = ['search_entity',
'get_disease_gene_associations',
'get_disease_phenotype_associations',
'get_gene_disease_associations',
'get_gene_phenotype_associations',
'get_phenotype_gene_associations',
'get_phenotype_disease_associations'])
Finally, the constructor is also where we register methods that the agent can call. Agent-callable methods are defined like normal, but to be properly callable they should be type-annotated and documented with docstrings parsable by docstring-parser.
## the agent can also call local methods, but we have to register them
self.register_callable_functions({'compute_entropy': self.compute_entropy})
## Callable methods should be type-annotated and well-documented with docstrings parsable by the docstring_parser library
def compute_entropy(self, items: Dict[Any, int]) -> float:
"""Compute the information entropy of a given set of item counts.
Args:
items (str): A dictionary of items and their counts.
Returns:
The information entropy of the item counts.
"""
from math import log2
total = sum(items.values())
return -sum([count / total * log2(count / total) for count in items.values()])
The above will allow the model to accurately answer questions like "What is the entropy of the tile counts in a standard Scrabble set?"
!
To use the agent, we first instantiate it and define a question to ask. The agent's .new_chat()
method takes the
question and yields a stream of Message
objects. It may yield multiple message objects if the agent decides
to call a function to answer the question. The first yielded Message will have is_function_call
set to True
and
information about the function call in other fields. The second message will be the result of the function call
in content
and role
set to "function"
; this is sent back to the model, resulting in a third message yielded with the
models' response in content
and role
set to "assistant
. It may be that the model's immediate response is another function
call, in which case function calls and results will continue to be yielded. It is also possible to yield the system message to the
stream with yield_system_message
and the question itself with yield_prompt_message
prior to the main message stream.
Messages are pydantic
models, so message.model_dump()
converts each message to a dictionary.
agent = MonarchAgent("Monarch Assistant")
question = "What genes are associated with Cystic Fibrosis?"
## agent.chat(question) may result in a series of Message objects (which may consist of a series of function-call messages,
## function-call responses, and other messages)
## by default, the system message and initial prompt question are not included in the output, but can be
for message in agent.chat(question, yield_system_message = True, yield_prompt_message = True, author = "User"):
## each Message object as the following attributes and defaults:
# role: str // required, either "user", "assistant", or "function" (as used by OpenAI API)
# author: str = None // the name of the author of the message
# intended_recipient: str = None // the name of the intended recipient of the message
# is_function_call: bool = False // whether the message represents the model attemtpting to make a function call
# content: Optional[str] = None // the content of the message (as used by OpenAI API)
# func_name: Optional[str] = None // the function name the model is trying to call (if is_function_call is True)
# func_arguments: Optional[Dict[str, Any]] = None // the function arguments the model is trying to pass (if is_function_call is True)
# finish_reason: Optional[str] = None // (as used by the OpenAI API, largely ignorable)
## the author and intended_recipient may be useful for multi-agent conversions or logging, they will typically be filled
## with agent names, "User", or the agent name and the function it is trying to call
print("\n\n", message.model_dump())
Once a chat has been initialized this way, it can be continued with further calls to .chat()
:
question_followup = "What other diseases are associated with the first one you listed?"
for message in agent.chat(question_followup, yield_prompt_message = True, author = "User"):
print("\n\n", message.model_dump())
question_followup = "What is the entropy of a standard tile set in Scrabble?"
for message in agent.continue_chat(question_followup, yield_prompt_message = True, author = "User"):
print("\n\n", message.model_dump())
Other functionality provided by agents includes .set_api_key()
for changing an agent's API-key mid-conversation, .clear_history()
for
clearing an agent's conversation history (but not it's token usage), and .compute_token_cost()
to estimate the total token cost of a potential
message, including the conversation history and function definitions. The basic UtilityAgent
comes with two callable functions by default, time()
and help()
, which report the current date and time to the model, and a summary of callable functions and API endpoints, respectively.
Streamlit-based UI
This package includes a basic, opinionated web-UI for serving agents based on streamlit, examples/streamlit_app.py
provides an example. We assume
an agent class such as MonarchAgent
in examples/monarch_agent.py
has been defined; this example is defined to accept the model name (e.g.
gpt-3.5-turbo-0613
) during the agent creation.
from monarch_agent import MonarchAgent
import agent_smith_ai.streamlit_server as sv
import os
import dotenv
dotenv.load_dotenv() # load env variables defined in .env file (if any)
Next we initialize the application, specifying the page title and icon and other application features. Arguments are passed
to streamlit's set_page_config()
, and calling this once before other functions below is required.
sv.initialize_app_config(
page_title = "Monarch Assistant",
page_icon = "https://avatars.githubusercontent.com/u/5161984?s=200&v=4",
initial_sidebar_state = "collapsed", # or "expanded"
menu_items = {
"Get Help": "https://github.com/monarch-initiative/agent-smith-ai/issues",
"Report a Bug": "https://github.com/monarch-initiative/agent-smith-ai/issues",
"About": "Agent Smith (AI) is a framework for developing tool-using AI-based chatbots.",
}
)
Next we define some agents. In order to make this performance with streamlit, we define a function that will return a dictionary
of agents when called, and then pass this function to sv.set_app_agents()
function. The agent dictionary keys are used to define
agent names, with values containing the agent object itself in "agent"
, a "greeting"
that is shown to the user by the agent when first
loaded (but that is not part of the agent's conversation history), and avatars for both the user and the agent, which can be characters (including
unicode/emoji) or URLs to images.
def get_agents():
return {
"Monarch Assistant": {
"agent": MonarchAgent("Monarch Assistant", model="gpt-3.5-turbo-16k-0613"),
"greeting": "Hello, I'm the Monarch Assistant.",
"avatar": "https://avatars.githubusercontent.com/u/5161984?s=200&v=4",
"user_avatar": "๐ค",
},
"Monarch Assistant (GPT-4)": {
"agent": MonarchAgent("Monarch Assistant (GPT-4)", model="gpt-4-0613"),
"greeting": "Hello, I'm the Monarch Assistant, based on GPT-4.",
"avatar": "https://avatars.githubusercontent.com/u/5161984?s=200&v=4",
"user_avatar": "๐ค",
}
}
# tell the app to use that function to create agents when needed
sv.set_app_agents(get_agents)
We can set a default OpenAI API key to use. If one is not provided this way, the user will need to enter one in the sidebar to chat. If one is set this way, the user can still enter their own key if they like, which will override the default key.
sv.set_app_default_api_key(os.environ["OPENAI_API_KEY"])
Lasly we start the app.
sv.serve_app()
To run the app, install streamlit
and run streamlit run examples/streamlit_app.py
. Messages are logged as they are generated and associated with session IDs for conversation tracking.
Notes on streamlit
Streamlit is a framework designed to make it easy to develop and deploy python-based web applications. Its execution model involves re-running the entire python script every time the UI changes or an action is taken, using deliberate state tracking and making heavy use of caching for efficiency. Beware of this if attempting to do extra work as part of the main application.
It is also easy to publish your streamit app to their community cloud. Note that at this time the application does not handle user authentication or rate-limiting of any kind.
You may want to add a .streamlit/config.toml
in the same directory as your app to adjust the default theme settings:
[theme]
base = "light"
primaryColor = "#4bbdff"
Additional Experiments and Examples
These are not complete and may be moved, but the following are currently included here:
agent_smith_ai.CLIAgent: A basic command-line agent with some formatting and markdown rendering provided by rich
. May be inhereted in the same way as UtilityAgent
for added functionality.
agent_smith_ai/bash_agent/main.py: Early version of a command-line-based AI assistant that can write and execute (after confirmation) complex commands.
Here's an example conversation from the examples/monarch_cli.py
which uses the CLIAgent
(sadly, markdown-defined colors and links are not shown here):
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ Welcome โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ Hello! I'm the Monarch Assistant, an AI-powered chatbot that can answer questions about genes, โ
โ diseases, and phenotypes, based on information hosted at https://monarchinitiative.org. โ
โ โ
โ โข You can exit by saying 'exit', and you can request that I turn on or off function call โ
โ responses by saying 'show function calls' or 'hide function calls' at any time. They are โ
โ shown by default. โ
โ โข I do not currently implement context-window management, so after a while your conversation โ
โ will produce an error. โ
โ โข For a bit of fun, try asking me to describe my plan. For example, "What are the symptoms of โ
โ Cystic Fibrosis? Describe your plan before you execute it." โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
User: What are the symptoms of Cystic Fibrosis? Describe your plan before you execute it.
โญโ Monarch Assistant -> Monarch Assistant (monarch-search_entity function) โโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ To find the symptoms of Cystic Fibrosis, I will first search for the disease using the term โ
โ "Cystic Fibrosis" in the Monarch Initiative knowledge graph. Once I have the ontology identifier โ
โ for Cystic Fibrosis, I will use it to retrieve the associated phenotypes. These phenotypes โ
โ represent the symptoms of the disease. I will then provide a description of the symptoms of โ
โ Cystic Fibrosis based on the retrieved information. โ
โ โ
โ Here is my plan: โ
โ โ
โ 1 Search for the disease "Cystic Fibrosis" in the Monarch Initiative knowledge graph. โ
โ 2 Retrieve the ontology identifier for Cystic Fibrosis. โ
โ 3 Use the ontology identifier to retrieve the associated phenotypes. โ
โ 4 Provide a description of the symptoms of Cystic Fibrosis based on the retrieved information. โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
โญโ Monarch Assistant -> Monarch Assistant (monarch-search_entity function) โโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ โ
โ monarch-search_entity(params = {'term': 'Cystic Fibrosis', 'category': 'biolink:Disease', โ
โ 'limit': 1}) โ
โ โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
โญโ Monarch Assistant (monarch-search_entity function) -> Monarch Assistant โโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ โ
โ { โ
โ "results": [ โ
โ { โ
โ "id": "MONDO:0009061", โ
โ "name": "cystic fibrosis", โ
โ "categories": [ โ
โ "biolink:Disease" โ
โ ], โ
โ "description": "Cystic fibrosis (CF) is a genetic disorder characterized by the โ
โ production of sweat with a high salt content and mucus secretions with an abnormal viscosity." โ
โ } โ
โ ], โ
โ "total": 3 โ
โ } โ
โ โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
โญโ Monarch Assistant -> Monarch Assistant (monarch-get_disease_phenotype_associations function) โโโโฎ
โ โ
โ monarch-get_disease_phenotype_associations(params = {'disease_id': 'MONDO:0009061', 'limit': โ
โ 10}) โ
โ โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
โญโ Monarch Assistant (monarch-get_disease_phenotype_associations function) -> Monarch Assistant โโโโฎ
โ โ
โ { โ
โ "associations": [ โ
โ { โ
โ "metadata": { โ
โ "frequency_qualifier": null, โ
โ "onset_qualifier": null โ
โ }, โ
โ "publications": [], โ
โ "phenotype": { โ
โ "metadata": {}, โ
โ "publications": [], โ
โ "phenotype_id": "HP:0004401", โ
โ "label": "Meconium ileus (HPO)" โ
โ } โ
โ }, โ
โ { โ
โ "metadata": { โ
โ "frequency_qualifier": null, โ
โ "onset_qualifier": null โ
โ }, โ
โ "publications": [], โ
โ "phenotype": { โ
โ "metadata": {}, โ
โ "publications": [], โ
โ "phenotype_id": "HP:0006528", โ
โ "label": "Chronic lung disease (HPO)" โ
โ } โ
โ }, โ
โ { โ
โ "metadata": { โ
โ "frequency_qualifier": null, โ
โ "onset_qualifier": null โ
โ }, โ
โ "publications": [], โ
โ "phenotype": { โ
โ "metadata": {}, โ
โ "publications": [], โ
โ "phenotype_id": "HP:0006538", โ
โ "label": "Recurrent bronchopulmonary infections (HPO)" โ
โ } โ
โ }, โ
โ { โ
โ "metadata": { โ
โ "frequency_qualifier": null, โ
โ "onset_qualifier": null โ
โ }, โ
โ "publications": [], โ
โ "phenotype": { โ
โ "metadata": {}, โ
โ "publications": [], โ
โ "phenotype_id": "HP:0100582", โ
โ "label": "Nasal polyposis (HPO)" โ
โ } โ
โ }, โ
โ { โ
โ "metadata": { โ
โ "frequency_qualifier": null, โ
โ "onset_qualifier": null โ
โ }, โ
โ "publications": [], โ
โ "phenotype": { โ
โ "metadata": {}, โ
โ "publications": [], โ
โ "phenotype_id": "HP:0002035", โ
โ "label": "Rectal prolapse (HPO)" โ
โ } โ
โ }, โ
โ { โ
โ "metadata": { โ
โ "frequency_qualifier": null, โ
โ "onset_qualifier": null โ
โ }, โ
โ "publications": [], โ
โ "phenotype": { โ
โ "metadata": {}, โ
โ "publications": [], โ
โ "phenotype_id": "HP:0002099", โ
โ "label": "Asthma (HPO)" โ
โ } โ
โ }, โ
โ { โ
โ "metadata": { โ
โ "frequency_qualifier": null, โ
โ "onset_qualifier": null โ
โ }, โ
โ "publications": [], โ
โ "phenotype": { โ
โ "metadata": {}, โ
โ "publications": [], โ
โ "phenotype_id": "HP:0002150", โ
โ "label": "Hypercalciuria (HPO)" โ
โ } โ
โ }, โ
โ { โ
โ "metadata": { โ
โ "frequency_qualifier": null, โ
โ "onset_qualifier": null โ
โ }, โ
โ "publications": [], โ
โ "phenotype": { โ
โ "metadata": {}, โ
โ "publications": [], โ
โ "phenotype_id": "HP:0002595", โ
โ "label": "Ileus (HPO)" โ
โ } โ
โ }, โ
โ { โ
โ "metadata": { โ
โ "frequency_qualifier": null, โ
โ "onset_qualifier": null โ
โ }, โ
โ "publications": [], โ
โ "phenotype": { โ
โ "metadata": {}, โ
โ "publications": [], โ
โ "phenotype_id": "HP:0002613", โ
โ "label": "Biliary cirrhosis (HPO)" โ
โ } โ
โ }, โ
โ { โ
โ "metadata": { โ
โ "frequency_qualifier": null, โ
โ "onset_qualifier": null โ
โ }, โ
โ "publications": [], โ
โ "phenotype": { โ
โ "metadata": {}, โ
โ "publications": [], โ
โ "phenotype_id": "HP:0003251", โ
โ "label": "Male infertility (HPO)" โ
โ } โ
โ } โ
โ ], โ
โ "total": 62, โ
โ "phenotype_url_template": "https://monarchinitiative.org/phenotype/{phenotype_id}" โ
โ } โ
โ โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
โญโ Monarch Assistant -> User โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ The symptoms of Cystic Fibrosis include: โ
โ โ
โ 1 Meconium ileus: This is a condition where the meconium, the first stool of a newborn, is โ
โ thick and sticky, causing a blockage in the intestines. More information โ
โ 2 Chronic lung disease: Cystic Fibrosis can lead to the development of chronic lung disease, โ
โ characterized by persistent respiratory symptoms such as coughing, wheezing, and shortness โ
โ of breath. More information โ
โ 3 Recurrent bronchopulmonary infections: Individuals with Cystic Fibrosis are prone to โ
โ frequent and recurrent infections in the bronchial tubes and lungs. More information โ
โ 4 Nasal polyposis: Cystic Fibrosis can cause the development of polyps in the nasal passages, โ
โ leading to nasal congestion and difficulty breathing through the nose. More information โ
โ 5 Rectal prolapse: In some cases, Cystic Fibrosis can result in the protrusion of the rectum โ
โ through the anus. More information โ
โ 6 Asthma: Individuals with Cystic Fibrosis may also experience symptoms of asthma, such as โ
โ wheezing and difficulty breathing. More information โ
โ 7 Hypercalciuria: Cystic Fibrosis can lead to increased levels of calcium in the urine, which โ
โ may result in the formation of kidney stones. More information โ
โ 8 Ileus: This refers to a blockage or obstruction in the intestines, which can occur in โ
โ individuals with Cystic Fibrosis. More information โ
โ 9 Biliary cirrhosis: In rare cases, Cystic Fibrosis can lead to the development of liver โ
โ disease, specifically biliary cirrhosis. More information โ
โ 10 Male infertility: Men with Cystic Fibrosis may experience infertility due to the absence or โ
โ blockage of the vas deferens, the tube that carries sperm from the testes. More information โ
โ โ
โ Please note that this is not an exhaustive list of symptoms, and the severity and presentation โ
โ of symptoms can vary among individuals with Cystic Fibrosis. It is important to consult with a โ
โ healthcare professional for a comprehensive evaluation and diagnosis. โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
User: That's nice. I know you can call local functions too - can you do that and tell me what time it is?
โญโ Monarch Assistant -> Monarch Assistant (time function) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ โ
โ time(params = {}) โ
โ โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
โญโ Monarch Assistant (time function) -> Monarch Assistant โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ โ
โ "08/02/23 10:28" โ
โ โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
โญโ Monarch Assistant -> User โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ The current time is 10:28 AM on August 2, 2023. โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
User: Fun! Can you hide the function calls, and then tell me the entropy of a standard scrabble set?
โญโ Monarch Assistant -> Monarch Assistant (hide_function_calls function) โโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ โ
โ hide_function_calls(params = {}) โ
โ โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
โญโ Monarch Assistant -> User โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ The entropy of a standard Scrabble set is approximately 4.37. โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
User: Nice :) What time is it now?
โญโ Monarch Assistant -> User โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ The current time is 10:29 AM on August 2, 2023. โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
User: Ok, show the function calls again, and tell me more about the CFTR gene.
โญโ Monarch Assistant (show_function_calls function) -> Monarch Assistant โโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ โ
โ null โ
โ โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
โญโ Monarch Assistant -> Monarch Assistant (monarch-search_entity function) โโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ โ
โ monarch-search_entity(params = {'term': 'CFTR', 'category': 'biolink:Gene', 'limit': 1}) โ
โ โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
โญโ Monarch Assistant (monarch-search_entity function) -> Monarch Assistant โโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ โ
โ { โ
โ "results": [ โ
โ { โ
โ "id": "HGNC:1884", โ
โ "name": "CFTR", โ
โ "categories": [ โ
โ "biolink:Gene" โ
โ ], โ
โ "description": null โ
โ } โ
โ ], โ
โ "total": 41 โ
โ } โ
โ โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
โญโ Monarch Assistant -> Monarch Assistant (monarch-get_gene_disease_associations function) โโโโโโโโโฎ
โ โ
โ monarch-get_gene_disease_associations(params = {'gene_id': 'HGNC:1884', 'limit': 10}) โ
โ โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
โญโ Monarch Assistant (monarch-get_gene_disease_associations function) -> Monarch Assistant โโโโโโโโโฎ
โ โ
โ { โ
โ "associations": [ โ
โ { โ
โ "metadata": { โ
โ "relationship": "causal" โ
โ }, โ
โ "publications": [], โ
โ "disease": { โ
โ "metadata": {}, โ
โ "publications": [], โ
โ "disease_id": "MONDO:0009061", โ
โ "label": "cystic fibrosis" โ
โ }, โ
โ "type": null โ
โ }, โ
โ { โ
โ "metadata": { โ
โ "relationship": "causal" โ
โ }, โ
โ "publications": [], โ
โ "disease": { โ
โ "metadata": {}, โ
โ "publications": [], โ
โ "disease_id": "MONDO:0010178", โ
โ "label": "congenital bilateral aplasia of vas deferens from CFTR mutation" โ
โ }, โ
โ "type": null โ
โ }, โ
โ { โ
โ "metadata": { โ
โ "relationship": "correlated" โ
โ }, โ
โ "publications": [], โ
โ "disease": { โ
โ "metadata": {}, โ
โ "publications": [], โ
โ "disease_id": "MONDO:0008185", โ
โ "label": "hereditary chronic pancreatitis" โ
โ }, โ
โ "type": null โ
โ }, โ
โ { โ
โ "metadata": { โ
โ "relationship": "correlated" โ
โ }, โ
โ "publications": [], โ
โ "disease": { โ
โ "metadata": {}, โ
โ "publications": [], โ
โ "disease_id": "MONDO:0008185", โ
โ "label": "hereditary chronic pancreatitis" โ
โ }, โ
โ "type": null โ
โ }, โ
โ { โ
โ "metadata": { โ
โ "relationship": "correlated" โ
โ }, โ
โ "publications": [], โ
โ "disease": { โ
โ "metadata": {}, โ
โ "publications": [], โ
โ "disease_id": "MONDO:0008887", โ
โ "label": "bronchiectasis with or without elevated sweat chloride 1" โ
โ }, โ
โ "type": null โ
โ }, โ
โ { โ
โ "metadata": { โ
โ "relationship": "correlated" โ
โ }, โ
โ "publications": [], โ
โ "disease": { โ
โ "metadata": {}, โ
โ "publications": [], โ
โ "disease_id": "MONDO:0009061", โ
โ "label": "cystic fibrosis" โ
โ }, โ
โ "type": null โ
โ }, โ
โ { โ
โ "metadata": { โ
โ "relationship": "correlated" โ
โ }, โ
โ "publications": [], โ
โ "disease": { โ
โ "metadata": {}, โ
โ "publications": [], โ
โ "disease_id": "MONDO:0018393", โ
โ "label": "male infertility with azoospermia or oligozoospermia due to single โ
โ gene mutation" โ
โ }, โ
โ "type": null โ
โ }, โ
โ { โ
โ "metadata": { โ
โ "relationship": "correlated" โ
โ }, โ
โ "publications": [], โ
โ "disease": { โ
โ "metadata": {}, โ
โ "publications": [], โ
โ "disease_id": "MONDO:0018801", โ
โ "label": "congenital bilateral absence of vas deferens" โ
โ }, โ
โ "type": null โ
โ }, โ
โ { โ
โ "metadata": { โ
โ "relationship": "correlated" โ
โ }, โ
โ "publications": [], โ
โ "disease": { โ
โ "metadata": {}, โ
โ "publications": [], โ
โ "disease_id": "MONDO:0018956", โ
โ "label": "idiopathic bronchiectasis" โ
โ }, โ
โ "type": null โ
โ }, โ
โ { โ
โ "metadata": { โ
โ "relationship": "correlated" โ
โ }, โ
โ "publications": [], โ
โ "disease": { โ
โ "metadata": {}, โ
โ "publications": [], โ
โ "disease_id": "MONDO:0044663", โ
โ "label": "aquagenic palmoplantar keratoderma" โ
โ }, โ
โ "type": null โ
โ } โ
โ ], โ
โ "total": 10, โ
โ "disease_url_template": "https://monarchinitiative.org/disease/{disease_id}" โ
โ } โ
โ โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
โญโ Monarch Assistant -> User โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ The CFTR gene, also known as the Cystic Fibrosis Transmembrane Conductance Regulator gene, is โ
โ associated with several diseases. Here are some of the diseases associated with the CFTR gene: โ
โ โ
โ 1 Cystic Fibrosis: The CFTR gene is causally associated with Cystic Fibrosis, a genetic โ
โ disorder characterized by the production of sweat with a high salt content and mucus โ
โ secretions with an abnormal viscosity. More information โ
โ 2 Congenital Bilateral Aplasia of Vas Deferens from CFTR Mutation: Mutations in the CFTR gene โ
โ can lead to the congenital absence of the vas deferens, which can cause infertility in males. โ
โ More information โ
โ 3 Hereditary Chronic Pancreatitis: The CFTR gene is correlated with hereditary chronic โ
โ pancreatitis, a condition characterized by inflammation of the pancreas that persists over โ
โ time. More information โ
โ 4 Bronchiectasis with or without Elevated Sweat Chloride 1: Mutations in the CFTR gene can also โ
โ be correlated with bronchiectasis, a condition characterized by the abnormal widening of the โ
โ bronchial tubes. More information โ
โ โ
โ Please note that this is not an exhaustive list of diseases associated with the CFTR gene. The โ
โ CFTR gene plays a crucial role in various physiological processes, and mutations in this gene โ
โ can have diverse effects on different organ systems. โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
Changelog
- 1.0.1: improved error logging
- 1.0.0:
- Replace .new_chat() and .continue_chat() with just chat()
- Update function spec to provide actual Callables, not just method nodes
- 0.14.0: Added streamlit-based UI component
- 0.13.0: Added ability to clear history
- 0.12.0: Added toxicity check for user messages with OpenAI Moderation endpoint
- 0.11.2: Added ability to swap out OpenAI API key for an active agent
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file agent_smith_ai-1.0.1.tar.gz
.
File metadata
- Download URL: agent_smith_ai-1.0.1.tar.gz
- Upload date:
- Size: 37.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d035333125b53b66c1b835dfcce58f00f0da0e8a0b755c925bb9c5438e60328 |
|
MD5 | 692284caf4f9263f2609a24aaaec9c8d |
|
BLAKE2b-256 | 97781b1c30bfd44166050c3fb8d2c6b9775760d5a983e6398a60ba31640581c3 |
File details
Details for the file agent_smith_ai-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: agent_smith_ai-1.0.1-py3-none-any.whl
- Upload date:
- Size: 33.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0761d31c2e9dbe9549b53380ab9f3e35d3fd1a91e921de177c152bdecdef79eb |
|
MD5 | db1a8177900b86e38c6888d53c620d7c |
|
BLAKE2b-256 | 9006db6579e111e81b798a0d66f55fe3ef691e24accf850f2e53f3f41f9711c7 |