![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
A versatile library designed to interact with various AI services, including text generation, image processing, and audio conversion.
A versatile library designed to interact with various AI services, including text generation, image processing, and audio conversion. It offers a flexible architecture that allows users to easily integrate multiple AI providers and switch between them based on their needs.
generateText
, generateImage
to different providers.Install the package with:
npm install aiapi
Import the aiapi
library.
import aiapi from 'aiapi'
or
const aiapi = require('aiapi')
aiapi
is designed to be flexible and easy to use, allowing you to interact with multiple AI services seamlessly. Below are some examples of how you can utilize the library in your projects.
First, import and initialize the Api
class with your desired AI providers:
const Api = require('aiapi')
// Initialize with your API keys and options
const api = new Api({
oai: [OpenAIProvider, 'your-openai-api-key', {/* options */}],
hf: [HuggingFaceProvider, 'your-huggingface-api-key', {/* options */}],
// Add more providers as needed
})
Use the API to generate text, images, or audio. By default, the method will use the provider assigned to it:
// Generate text using the default provider for text generation
api.generateText("Hello, world!").then(console.log)
// Generate an image
api.generateImage("A sunny beach").then(console.log)
You can also interact directly with a specific provider, bypassing the default method assignments:
// Directly call the Hugging Face provider
api.providers.hf.generateText("Direct call to Hugging Face").then(console.log)
// Or just leverage the Proxy constructor
api.hf.generateText("Direct call to Hugging Face").then(console.log)
The assignMethod
function allows you to dynamically assign a specific method to a provider. This is useful if you want to change the provider for a particular functionality at runtime:
// Assign the 'generateText' method to use the 'hf' (Hugging Face) provider
api.assignMethod('generateText', 'hf')
// Now, calling generateText will use the Hugging Face provider
api.generateText("Switched to Hugging Face").then(console.log)
You can easily add a new provider or override an existing one:
class CustomProvider extends AIProvider {
// Implement your custom provider
}
// Register a new provider
api.registerProvider('custom', new CustomProvider('your-api-key', { /* options */ }))
// Optionally, assign methods to your new provider
api.assignMethod('generateText', 'custom')
You can extend the AIProvider
class to create custom providers. This allows integrating any AI service into the aiapi
ecosystem.
In order to run the test suite, simply clone the repository and install its dependencies:
git clone https://gitlab.com/frenware/ai/aiapi.git
cd aiapi
npm install
To run the tests:
npm test
Thank you! Please see our contributing guidelines for details.
If you find this project useful and want to help support further development, please send us some coin. We greatly appreciate any and all contributions. Thank you!
Bitcoin (BTC):
1JUb1yNFH6wjGekRUW6Dfgyg4J4h6wKKdF
Monero (XMR):
46uV2fMZT3EWkBrGUgszJCcbqFqEvqrB4bZBJwsbx7yA8e2WBakXzJSUK8aqT4GoqERzbg4oKT2SiPeCgjzVH6VpSQ5y7KQ
aiapi is MIT licensed.
FAQs
A versatile library designed to interact with various AI services, including text generation, image processing, and audio conversion.
We found that aiapi 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.