@wral/sdk-ai
v0.0.0
Published
A Software Development Kit for working with Studio AI
Keywords
Readme
Studio AI SDK
npm install publisher-sdkUsage
import { createClient } from '@wral/sdk-ai/v1';Then, you can create a client instance with your configuration:
const config = {
apiKey: 'YOUR_API_KEY',
baseUrl: 'YOUR_BASE_URL', // Base URL of your AI API
};
const client = createClient(config);After creating the client instance, you can use its method api() to make API calls to the Publisher API. Here's an example:
// Make API call using api() method
const response = await client.chatCompletion({
messages: [{ role: 'user', content: 'Hello!' }],
numChoices: 2,
temperature: 0.5,
});
console.log(response);API
createClient(config)
Creates a new client instance with the provided configuration.
config: An object containing API configuration parameters:apiKey: The API key for authentication.baseUrl: The base URL of the Publisher API.
Returns a client instance with a method api() for making API calls.
Methods
api(path, options): Makes an API call to the Publisher API using the provided path and optionspath: The path to the API endpointoptions: The fetch options (e.g., method, headers, body)
chatCompletion({ messages, numChoices, temperature, maxTokens }): Sends a chat completion request to the Publisher API.
Methods return a promise that resolves with the response from the API.
