medpromptjs
v0.5.5
Published
A library of langchain base classes for building medical applications.
Readme
medpromptjs
A set of base classes for making GenAI application development easy. Implements the LLM-in-the-Loop CQL execution on unstructured data.
Installation
npm i --save medpromptjsUsage
BaseLLM
BaseLLM is a base class for LLMs that communicate with a remote API. It extends the LangChain LLM class and provides configurable parameters for model inference.
import { BaseLLM } from 'medpromptjs';
const llm = new BaseLLM({
baseUrl: 'http://localhost:8080/api/chat',
model: 'llama2',
apiKey: 'your-api-key', // optional
temperature: 0.1,
maxOutputTokens: 512,
});
const response = await llm.invoke('Hello, how are you?');BaseEmbedding
BaseEmbedding is a base class for embeddings that communicate with a remote API. It extends the LangChain Embeddings class.
import { BaseEmbedding } from 'medpromptjs';
const embedding = new BaseEmbedding({
baseUrl: 'http://localhost:8080/api/embeddings',
model: 'nomic-embed-text',
apiKey: 'your-api-key', // optional
});
// Embed multiple documents
const embeddings = await embedding.embedDocuments(['doc1', 'doc2']);
// Embed a single query
const queryEmbedding = await embedding.embedQuery('search query');Give us a star ⭐️
If you find this project useful, give us a star. It helps others discover the project.
Related projects
- FHIRy - FHIR to pandas dataframe
- kedro-multimodal - Template for multi-modal machine learning in healthcare using Kedro
- ckblib - A library for clinical knowledge graphs
Contributing
- PR welcome
