Code Monkey home page Code Monkey logo

nlpcloud / nlpcloud-js Goto Github PK

View Code? Open in Web Editor NEW
43.0 7.0 3.0 88 KB

NLP Cloud serves high performance pre-trained or custom models for NER, sentiment-analysis, classification, summarization, paraphrasing, intent classification, product description and ad generation, chatbot, grammar and spelling correction, keywords and keyphrases extraction, text generation, image generation, code generation, and much more...

Home Page: https://nlpcloud.com

License: MIT License

Dockerfile 9.69% JavaScript 90.31%
nlp sentiment-analysis text-classification machine-translation language-detection text-generation question-answering text-summarization ner tokenization

nlpcloud-js's People

Contributors

juliensalinas avatar smervs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

nlpcloud-js's Issues

Not a problem, but a suggestion

Hey, just wanted to provide some feedback.

It'd be really convenient if you were to put in an enum of sorts that contained every model that's available by request type.

Would save a trip to the website and help cleanup user code.

ReferenceError: params is not defined

Running the example for question answering:

const NLPCloudClient = require('nlpcloud');

const client = new NLPCloudClient({ model: 'finetuned-llama-2-70b', token: '<redacted>', gpu: true })
client.question({
    question: `How many threats are blocked per day?`,
    context: `We have built security into every component of the network. Cloudflare’s 155 Tbps network blocks an average of 70 billion threats per day, including some of the largest DDoS attacks ever recorded. Each and every login, request, and response that goes through our network strengthens the machine learning that we apply to detect and block threats at the edge, before they ever reach your organization.`
}).then(function (response) {
    console.log(response.data);
}).catch(function (err) {
    console.error(err.response.status);
    console.error(err.response.data.detail);
});

throws the following error:

ReferenceError: params is not defined
    at Client.question (C:\Users\user\Documents\AI Answering\node_modules\nlpcloud\index.js:244:20)
    at Object.<anonymous> (C:\Users\user\Documents\AI Answering\index.js:4:8)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
    at node:internal/main/run_main_module:17:47

Question api returns 404 for fast-gpt-j

Tried out the API like this and it fails with 404 Request failed with status code 404.

It works if I change the model to roberta-base-squad2.

const NLPCloudClient = require('nlpcloud');
const apiToken = 'token';
const client = new NLPCloudClient('fast-gpt-j',apiToken);

async function test11() {
  const response = await client.question(`When can plans be stopped?`,
    `All NLP Cloud plans can be stopped anytime. You only pay for the time you used the service. In case of a downgrade, you will get a discount on your next invoice.`)
  console.log('response', response);
}

test11().catch(console.error);

TypeScript typings

It would be awesome if you could include typings for TypeScript either as part of this package (preferably) or alternatively as a DT.

Thanks for providing an awesome NLP service!

Translation source and target

the translation function does not allow me to specify source and target languages of the text, it only takes the text as a parameter despite the examples in the endpoints documentation showing 'text' , 'source' , 'target' as the three parameters of this function.
Am I missing something here?

https://docs.nlpcloud.com/?javascript#translation

Note: I got this probelm while using the nlpcloud package in my NestJs application

Suggestion: improve types from summary response

Hello,
I really like NL cloud and wanted to give you a quick feedback in regards to the typing issues I'm facing. I'm using the summarization function, and the return type is hard to use and a bit confusing:

 Promise<{
        status: number;
        statusText: string;
        data: {
            summary_text: string;
        };
    } | {
        status: number;
        statusText: string;
        data: {
            url: string;
        }
    }

TS is confused when I get the response back as it does not know if data contains an url or a summary_text. I'm not sure which case we get an url or a string, but would be nice to know in advance, otherwise a quick fix could look like this:

 Promise<{
        status: number;
        statusText: string;
        data: DataTypeText;
    } | {
        status: number;
        statusText: string;
        data: DataTypeUrl;
    }

and simply export the data type so we can type it when we get back the response ourself, right now I'm simply using // @ts-ignore which I would like to avoid.

BYO HTTP Client

Even without out the account limits endpoint and built-in rate limiting requested in #3 , the option to bring our own Axios (or fetch since it will be future node core?) where we have implemented the rate limit at the client would be have some nice ergonomics.

Mistake in typescript package

the generation endpoint is expecting

  • temperature : float,
  • length_penalty : float,
  • repetition_penalty : float,
  • top_p : float,

but in the typescript package, the generation constructor has these values defined as type 'number' which is causing a 422 error from the server

the constructor also does not have top_p as a parameter at all

Use new major version when introducing breaking changes

Your latest release 1.0.49 introduced a functional change in the way the parameters are passed into the NLPCloudClient interface, and was released as a patch version update.

This broke our integration with NLPCloud, and loss of trust in the service, trying to figure out what is happening.

I would suggest you do the following:

  • Whenever you add breaking changes in the public interface of this library, add a major library update so that people can upgrade your library with confidence.
  • Use minor when adding new functionality and patch when fixing bugs.
  • Maintain a proper changelog in this repo, or document significant changes like this in your Github releases.

feature: discover and utilize account limits

I think it would be slick if the the client could discover the account limits, such as rate limits the token is approved for and to configure Axios to use that limit.

This just a nice to have in being "good" consumers without implementing 429 handling.

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.