medpromptjs
    Preparing search index...

    medpromptjs

    medpromptjs

    A set of base classes for making GenAI application development easy. Implements the LLM-in-the-Loop CQL execution on unstructured data.

    npm version npm Build codecov Known Vulnerabilities Documentation

    npm i --save medpromptjs
    

    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 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');

    If you find this project useful, give us a star. It helps others discover the project.

    • PR welcome