
Research
PyPI Package Disguised as Instagram Growth Tool Harvests User Credentials
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
feathers-openai
Advanced tools
NOTE: This library is new
This library enables a series of FeathersJS services that map to the entities and routes of the OpenAI API.
By wrapping the API in a set of FeathersJS services, developers can quickly integrate any subset of the OpenAI API into their FeathersJS application. This enables the developer to log, manipulate, wrap hooks around, and make direct or indirect calls to the API.
openai/embeddings
)openai/fine-tunes/:id/cancel
)/my-openai-prefix/models
)multer
create
calls.[x] - Integrate all routes with FeathersJS [x] - Incorporate uploads via buffer streams [x] - Document multer example with KoaJS [ ] - Document multer example with ExpressJS [x] - Testing for uploads [x] - Testing for configuration [x] - Testing for sample services [ ] - Expand testing to cover all services
NOTE: PRs are welcome!
To install the services, add the library as a dependency.
npm install --save feathers-openai multer @koa/multer
In your app.js
file, add the following middleware calls:
import koamulter from '@koa/multer';
import { openaiMulter, openai } from 'feathers-openai';
app.use(koamulter().any());
app.use(openaiMulter);
The koamulter
captures multi-part form uploads to your endpoints. The openaiMulter
appends the file(s) to the ctx.feathers
object, making the buffers accessible within the hook and service params
. The multer
library or equivalent is required by koamulter
.
In your src/services/index.js
add the following:
import { openai } from 'feathers-openai'
export const services = (app) => {
app.configure(openai('openai'))
// ... other services
}
API Key in [env].json
You must add your API key in your /config/[env].json
file.
{
"openai":"sk-XXXXXXXXXXXXXXXXXXXXXX"
}
Service Options:
prefix
(optional, default: openai
) - The prefix added to every OpenAI service route. This allows you to nest the services so that their common names (i.e. model
, etc.) don't overwrite your core application services. The default setting will result in routes like openai/models
and openai/fine-tunes
.allowedEntities
(optional, default: all). This option allows you to disable and prevent the loading of any of the OpenAI API routes and entities. It takes an array of entity names. For example, setting allowedEntities=['models']
would enable only the openai/models
service. This list of services are:
models
edits
completions
images/generations
images/edits
images/variations
fine-tunes
embeddings
moderations
files
The services come with no hooks by default. You can add hooks by simply setting the hooks property after app.configure
. For example:
export const services = (app) => {
app.configure(openai('openai'))
attachOpenAIhooks(app)
// ... other services
}
function attachOpenAIhooks(app){
app.service('openai/models).hooks({
before:{
all:[()=>console.log('in the models hook!')]
}
})
}
You can also directly leverage the service as part of another service flow, like using the AI to write a title for an article.
app.service('articles').hooks({
before:{ create:[
(ctx)=>{
let text = ctx.data.text;
ctx.data.title = ctx.app.service('openai/completions)
.create({
model: "text-davinci-003",
prompt: `Write a clickbait title for the following text:\n${text}\n####`,
max_tokens: 7,
temperature: 0,
stop:'###'
}).then(r=>r.choices[0].text)
}]
}
})
Adapter Syntax: feathers-openai
does NOT implement the Feathers Common database adapter API
Pagination: The current OpenAI API does not demonstrate how they will provide pagination for large responses, so for find
method calls, the total
, $limit
and $skip
are server-side manipulations of the OpenAI response and will not reduce the call on the OpenAI side. Any calls to find
will return the standard feathers object { total:x ... data:[...]}
but create
, get
, remove
,update
will return as close to the original OpenAI response.
Queries/Search: There is NO query capability for the OpenAI API so it is not implemented here. This library does not implement the FeathersJS querying syntax.
FAQs
An open.ai adapter for FeathersJS
The npm package feathers-openai receives a total of 0 weekly downloads. As such, feathers-openai popularity was classified as not popular.
We found that feathers-openai 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
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
Security News
Research
Socket uncovered two npm packages that register hidden HTTP endpoints to delete all files on command.