About

Are you a developer looking to integrate artificial intelligence into your Node.js applications? This cheat sheet provides a practical overview of key concepts and tools to get you started.

This resource is designed to help you quickly grasp the essentials of AI development in the Node.js environment. It offers a straightforward introduction to large language models (LLMs) and the necessary tools to start incorporating AI features into your web and server-side applications. If you're interested in exploring how to use AI within your existing projects, this cheat sheet is a helpful starting point.

What's inside:

  • Model selection: Guidance on factors to consider when choosing an LLM, including performance, scalability, and licensing.
  • Model servers: Introduction to running LLMs locally with tools like Ollama and Podman AI Lab.
  • Client libraries: Key libraries like LangChain.js and LangGraph.js for interacting with AI APIs.
  • Core concepts: Practical implementation examples for chatbots, retrieval-augmented generation (RAG), and agents with tool calling.

With Red Hat Developer cheat sheets, you get essential information right at your fingertips so you can work faster and smarter. Easily learn new technologies and coding concepts and quickly find the answers you need.

Excerpt

Chatbots

A chatbot is a computer program that simulates human conversation with an end user. While not all chatbots use AI, modern chatbots increasingly use conversational AI techniques such as natural language processing to understand user questions and automate responses to them.

A simple chatbot with Langchain.js

 const model = getModel();

  const prompt = ChatPromptTemplate.fromMessages([
    [ 'system',  'You are a helpful assistant'],
    [ 'human', '{input}' ]
  ]);

  const chain = prompt.pipe(model);
  const response = await chain.invoke({
    input: 'What is the weather today?'
  });

  return response;

Related Cheat sheets