Giter Site home page Giter Site logo

qna-with-pdf's Introduction

QNA With PDF

Now you can qna with your pdf files.

Example Usage

Sample code is as follows.

const { QNAWithPDF } = require('./') 
// or ES6 remove the comment 
// import { QNAWithPDF } from './index.js'

const qnaWithPDF = new QNAWithPDF('./config.json');

qnaWithPDF.init('./invoice.pdf').then(qna => {
    qna.answer("How much is the total cost of the invoice ?")
        .then(result => {
            return result; // You will see the result here.
        })
        .catch(e => {
            throw new Error(e);
        })
})

if you want run with javascript run this folowing command in your command line;

    npm run build

And you will see in your directory a dist folder. Now you will run this project with javascript.

Note: Don't forget the import changes. You should import from dist folder.

Config File

The sample configuration file is included in the library. You can see the default content of the config file below.

    {
    "chroma": {
        "collectionName": "collection_name", // change your chroma collection name
        "url": "http://localhost:8000" // change your chroma server url
    },
    "textSplitter": { // text splitter initial values
        "chunkSize": 100,
        "chunkOverlap": 50
    },
    "inference": { // HuggingFaceInference Class initial values
        "apiKey": "-", // hugging face api key
        "temperature": 1.0,
        "maxTokens": 50,
        "model": "-" // provide a model in hugging face 
    },
    "inferenceEmbeddings": { // HuggingFaceInferenceEmbeddings initial values
        "apiKey": "-" // provide a hugging face api key
    }
}

You can find the model that suits you on Hugging Face.

Dependencies

Pyhton

You should have python version >= 3.11.6

Chroma DB

You must have a chroma db on your project.

    npm install --save chromadb
    # or 
    yarn add chromadb

and follow this command

    pip install chromadb

last step

    #if your location equals to db path you can write and run only chroma run
    chroma run --path /db_path

For more informations click here.

Hugging Face

You must have a hugging face access token. And you must add to access token for config.json file.

Suggestions

Please make sure you provide the fields in the config file content.

Next Features

  • Multiple PDF support
  • Memory support
  • Less dependency and modularity

qna-with-pdf's People

Contributors

suleymansevimli avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.