npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

qanswer-sdk

v3.1400.0-main

Published

OpenAPI client for qanswer-sdk

Readme

🔮 QAnswer SDK (TypeScript + Axios)

npm version License: MIT Build Status

🚀 Official TypeScript/axios client for the QAnswer API, auto-generated from our OpenAPI spec.
Quickly integrate QAnswer into your JavaScript/TypeScript projects with minimal setup.


✨ Features

  • OpenAPI-Generated: Built using OpenAPI Generator for robust and reliable API handling.
  • TypeScript Support: Includes full typing for a better developer experience.
  • Axios Integration: Uses Axios under the hood for HTTP requests.
  • Flexible Authentication: Easily configure API key or OAuth2 token-based authentication.
  • Modular and Compatible: Works in both Node.js and modern front-end bundlers like Webpack and Browserify.

📦 Installation

npm install qanswer-sdk

or with Yarn:

yarn add qanswer-sdk

🚀 Usage

Importing the SDK

The SDK can be used with both TypeScript and JavaScript.

🖥️ In TypeScript:

import { Configuration, DatasetApi } from "qanswer-sdk";  

// Setup configuration  
const configuration = new Configuration({  
  apiKey: "YOUR_API_KEY",  
  basePath: "https://api.qanswer.com",  
});  

// Create an instance of the API you want to use  
const datasetApiInstance = new DatasetApi(configuration);  

// Example: Creating a new dataset  
datasetApiInstance  
  .createDataset({  
    name: "sample_dataset",  
    language: "en",  
    datasetType: "qa",  
    description: "A sample dataset",  
  })  
  .then((response) => {  
    console.log("Dataset created successfully!", response);  
  })  
  .catch((error) => {  
    console.error("Error creating dataset:", error);  
  });  

🛠️ In JavaScript:

const { Configuration, DatasetApi } = require("qanswer-sdk");  

// Setup configuration  
const configuration = new Configuration({  
  apiKey: "YOUR_API_KEY",  
  basePath: "https://api.qanswer.com",  
});  

// Create an API instance  
const datasetApiInstance = new DatasetApi(configuration);  

// Example: Creating a new dataset  
datasetApiInstance  
  .createDataset({  
    name: "sample_dataset",  
    language: "en",  
    datasetType: "qa",  
    description: "A sample dataset",  
  })  
  .then((response) => {  
    console.log("Dataset created successfully!", response);  
  })  
  .catch((error) => {  
    console.error("Error creating dataset:", error);  
  });  

🔐 Authentication

Authenticate QAnswer API requests using:

API Key Authentication:

Provide the API key when initializing Configuration:

const configuration = new Configuration({  
  apiKey: "YOUR_API_KEY",  
}); 

Bearer Token (OAuth2) Authentication:

Supply a bearer token during configuration:

const configuration = new Configuration({  
  accessToken: "YOUR_BEARER_TOKEN",  
});  

📚 Available APIs

The SDK is organized into separate API modules for better usability. Below are some of the key APIs with example usage.

📁 Dataset API

Create a Dataset

const datasetPayload = {  
  name: "my_dataset",  
  language: "en",  
  datasetType: "qa",  
  description: "A dataset for Q&A tasks",  
};  

datasetApiInstance  
  .createDataset(datasetPayload)  
  .then((response) => {  
    console.log("Dataset created successfully!", response);  
  })  
  .catch((error) => {  
    console.error("Error creating dataset:", error);  
  });

List All Datasets

datasetApiInstance  
  .listDatasets()  
  .then((datasets) => {  
    console.log("Available datasets:", datasets);  
  })  
  .catch((error) => {  
    console.error("Error retrieving datasets:", error);  
  });  

📑 Document API

Add Q&A Pairs

const qnaPayload = {  
  username: "user123",  
  dataset: "my_dataset",  
  connector_id: 42,  
  quota: 100,  
  qna_pairs: [  
    {  
      question: "What is QAnswer?",  
      answer: "QAnswer is an intelligent assistant platform.",  
    },  
  ],  
};  

qaApiInstance  
  .addQnA(qnaPayload)  
  .then((response) => {  
    console.log("Q&A added successfully!", response);  
  })  
  .catch((error) => {  
    console.error("Error adding Q&A pairs:", error);  
  });  

🕵️ PDF Search API

Search in a PDF

const pdfSearchPayload = {  
  username: "user123",  
  dataset: "my_dataset",  
  filename: "document.pdf",  
  task_name: "search",  
};  

pdfApiInstance  
  .searchInPDF(pdfSearchPayload)  
  .then((results) => {  
    console.log("Search results:", results);  
  })  
  .catch((error) => {  
    console.error("Error during PDF search:", error);  
  }); 

⚙️ Custom Configuration

Customize SDK behavior by passing additional settings to the Configuration object:

const configuration = new Configuration({  
  apiKey: "YOUR_API_KEY",  
  basePath: "https://api.qanswer.com",  
  baseOptions: {  
    timeout: 10000, // Set request timeout to 10 seconds  
  },  
}); 

📚 Documentation

🌐 API Reference → QAnswer API Swagger


📝 License

This project is licensed under the MIT License


Made with ❤️ by The QA Company