Public
Edited
Feb 28, 2024
Insert cell
Insert cell
viewof openaiApiKey = Inputs.text({label: "OpenAI API Key", placeholder: "Enter your OpenAI API Key"})
Insert cell
langchain = import("https://esm.sh/langchain/llms/openai");
Insert cell
chains = import("https://esm.sh/langchain/chains")
Insert cell
langchainParser = import("https://esm.sh/langchain/output_parsers")
Insert cell
zodSchema = z.object({
"person-name": z.string().describe("The person's name"),
"person-age": z.number().describe("How old the person is"),
"notable-achievements": z.string().describe("Anything that would show up on the person's resume"),
"hobbies": z.string().describe("Anything the person likes to do with his free time"),
"educational-history": z.string().describe("Where the person received his education, including his PHD or bachelor's degree."),
});
Insert cell
EXTRACTION_TEMPLATE = `Extract and save the relevant entities mentioned in the following passage together with their properties.

If a property is not present and is not required in the function parameters, do not include it in the output.`;

Insert cell
prompts = import("https://esm.sh/langchain/prompts");
Insert cell
ChatPromptTemplate = prompts.ChatPromptTemplate
Insert cell
prompt = ChatPromptTemplate.fromMessages([
["system", EXTRACTION_TEMPLATE],
["human", "{input}"],
]);
Insert cell
z = await import ('https://cdn.jsdelivr.net/npm/zod@3.22.2/+esm')
Insert cell
zodJSON = await import("https://esm.sh/zod-to-json-schema@3.22.3")
Insert cell
ChatOpenAI = chatModels.ChatOpenAI
Insert cell
model = new ChatOpenAI({
modelName: "gpt-3.5-turbo-1106",
temperature: 0,
openAIApiKey: openaiApiKey
}).bind({
tools: [
{
type: "function",
function: {
name: "person",
description: "A person",
parameters: zodJSON.zodToJsonSchema(zodSchema),
},
},
],
});
Insert cell
chatModels = import("https://esm.sh/langchain/chat_models/openai");
Insert cell
parser = new langchainParser.JsonOutputToolsParser();

Insert cell
chain = prompt.pipe(model).pipe(parser);


Insert cell
Description = `Dr. Jonas Almeida leads a multidisciplinary program of data science and engineering research that combines systems biology, computational statistics, and software engineering for biomedical applications. The primary focus of his research is to accelerate the investigation of epidemiologic and genetic causes of cancer by developing innovative digital methods that advance the computational research infrastructure for precision prevention.

Dr. Almeida seeks to identify and deliver consumer-facing architectures for precision medicine and prevention that employ cloud computing, web applications, and machine learning. He explores this interrelated computational ecosystem by developing portable software solutions that can migrate between data sources – from consumer genomics and digital pathology to wearable sensing devices; and between different contexts of application, from patients to caregivers.

As Director of Data Science for the NCI Division of Cancer Epidemiology and Genetics (DCEG), Dr. Almeida has the dual responsibilities of 1) leading efforts for the integrated creation, management, and analysis of data-intensive knowledge bases, establishing cost-effective scalable researcher-facing analytic infrastructure, and defining new infrastructure to extract, manage, and analyze data to support epidemiological research within the Division; and 2) conducting independent research to advance real-time analytics of cancer “Big Data”. He provides support for the data and technology infrastructure used by the new prospective multi-center cohort study that will serve as an important Division-wide resource.

Dr. Almeida received his Ph.D. in Biological Engineering from the University Nova of Lisbon, Portugal, in 1995. After a postdoctoral fellowship in computational statistics and machine learning at the University of Tennessee and Oak Ridge National Laboratory, he became an Assistant Professor in Chemistry at the University of Lisbon in 1996, followed by an appointment as an Associate Professor of Biostatistics at the Medical University of South Carolina in 2001 and as a tenured Professor of Bioinformatics in the Division of Applied Mathematics of the University of Texas MD Anderson Cancer Center in 2006. In 2008, MD Anderson awarded Dr. Almeida the endowed Abell-Hanger Distinguished Professorship in Bioinformatics. In 2011, he was recruited to be the inaugural Director of a new Division of Informatics and tenured Professor in the Department of Pathology of the University of Alabama at Birmingham. In 2015, he joined Stony Brook University as a tenured Professor and Chief Technology Officer. Dr. Almeida was appointed Director of Data Science of DCEG in 2019. In 2021, he received the DCEG Outstanding Mentor Award.`
Insert cell
res = await chain.invoke({
input: Description,
});

Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more