Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
openai-streams
Advanced tools
This library returns OpenAI API responses as streams only. Non-stream endpoints
like edits
etc. are simply a stream with only one chunk update.
It simplifies the following:
OPENAI_API_KEY
from process.env
.OpenAI(endpoint, ...)
signature.Overall, the library aims to make it as simple to call the API as possible and stream updates in.
yarn add openai-streams
# or
npm i --save openai-streams
Set the OPENAI_API_KEY
env variable.
The runtime will throw if it cannot find an API key.
Call the API via await OpenAI(endpoint, params)
.
The params
type will be inferred based on the endpoint
you provide, i.e.
for the "edits"
endpoint, import('openai').CreateEditRequest
will be
enforced.
import { OpenAI } from "openai-streams";
export default async function test() {
const stream = await OpenAI(
"completions",
{
model: "text-davinci-003",
prompt: "Write a two-sentence paragraph.\n\n",
temperature: 1,
max_tokens: 100,
// apiKey: "abc123",
},
);
return new Response(completionsStream);
}
for await (const chunk of yieldStream(stream)) { ... }
. We recommend following this
pattern if you find it intuitive.FAQs
Tools for working with OpenAI streams in Node.js and TypeScript.
The npm package openai-streams receives a total of 770 weekly downloads. As such, openai-streams popularity was classified as not popular.
We found that openai-streams demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.