Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
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.
Overall, 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.
Set the OPENAI_API_KEY
env variable.
The runtime will throw if this is not available.
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.
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,
},
);
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.
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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.