Skip to content

emergentmethods/asknews-typescript-sdk

Repository files navigation

@emergentmethods/[email protected]

Typescript SDK for the AskNews API. This SDK utilizes Fetch API. The generated Node module can be used in the following environments:

Environment

  • Node.js
  • Webpack
  • Browserify

Language level

  • ES5 - you must have a Promises/A+ library installed
  • ES6

Module system

  • CommonJS
  • ES6 module system

It can be used in both TypeScript and JavaScript. In TypeScript, the definition should be automatically resolved via package.json. (Reference)

Installation

npm install @emergentmethods/[email protected] --save

Usage

import { AskNewsSDK } from "@emergentmethods/asknews-typescript-sdk";

const ask = new AskNewsSDK({
  clientId: "YOUR-CLIENT-ID",
  clientSecret: "YOUR-CLIENT-SECRET",
  scopes: ["news"],
});

// prompt-optimized string ready to go for any LLM:
const newsContext = (
  await ask.news.searchNews({
    query: "Effect of fed policy on tech sector",
    returnType: "string",
  })
).asString;

console.log(newsContext);

And you will have a prompt-optimized string ready to go for any LLM.

Find full details at the AskNews API documentation.

Support

Join our Discord to see what other people are building, and to get support with your projects.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published