Skip to main content

Alchemyst AI Retriever

The Alchemyst AI Retriever enables your generative AI applications to retrieve relevant context and knowledge. It sources this information from the Alchemyst platform. It provides a unified interface for accessing, searching, and retrieving data to enhance LLM and agent responses.

Setup

  1. If you don’t have an account, sign up for a new account on the Alchemyst Platform.
  2. After logging in, go to Alchemyst Platform Settings to get your API keys.
npm i @alchemystai/langchain-js

Usage

import { AlchemystRetriever } from "@alchemystai/langchain-js";
import { RunnableSequence } from "@langchain/core/runnables";
import dotenv from "dotenv";

dotenv.config();

// Instantiate the retriever with your API key and optional config
const retriever = new AlchemystRetriever({
  apiKey: process.env.ALCHEMYST_AI_API_KEY!,
  similarityThreshold: 0.8,
  minimumSimilarityThreshold: 0.5,
  scope: "internal"
});

// Example: Use the retriever in a LangChain pipeline
async function main() {
  // Create a simple pipeline that retrieves documents and outputs their content
  const pipeline = RunnableSequence.from([
    async (input: string) => {
      const docs = await retriever.getRelevantDocuments(input);
      return docs.map(doc => doc.pageContent).join("\n---\n");
    }
  ]);

  const query = "Show me the latest HR policies"; // Put your business/practical query here
  const result = await pipeline.invoke(query);

  console.log("Retrieved Documents:\n", result);
}

main().catch(console.error);

Support and Feedback

For support, feedback, or to report issues, please visit the Alchemyst AI Documentation, where you’ll find the latest contact and community information.
I