kamburga-services
v1.0.0
Published
Kamburga API Services Client
Maintainers
Readme
Kamburga Services
A client library for interacting with the Kamburga API services.
Installation
npm install kamburga-servicesUsage
const KamburgaServices = require('kamburga-services');
// Initialize with your API key
const client = new KamburgaServices('your-api-key');
// Example: Chat completion
async function getCompletion() {
try {
const response = await client.chat.completions.create({
messages: [
{ role: 'user', content: 'Hello, how are you?' }
],
model: 'gpt-3.5-turbo',
max_tokens: 100
});
console.log(response.choices[0].message.content);
} catch (error) {
console.error('Error:', error.message);
}
}
getCompletion();Turkish Function Names
The library provides Turkish function names for signature purposes:
const KamburgaServices = require('kamburga-services');
const client = new KamburgaServices('your-api-key');
// Using Turkish function names
async function turkceOrnek() {
try {
const yanit = await client.kamburga.tamamlamalar.olustur({
messages: [
{ role: 'user', content: 'Merhaba, nasilsin?' }
],
model: 'gpt-3.5-turbo',
max_tokens: 100
});
console.log(yanit.choices[0].message.content);
} catch (hata) {
console.error('Hata:', hata.message);
}
}
turkceOrnek();Available Turkish functions:
client.kamburga.tamamlamalar.olustur()- Create chat completionsclient.kamburga.modeller.listele()- List modelsclient.kamburga.modeller.getir()- Retrieve a modelclient.kamburga.sohbetOturumu()- Create a chat sessionclient.kamburga.yapilandirma()- Get configurationclient.kamburga.ornek()- Get examplesclient.kamburga.lisansDogrula()- Validate license
Using Chat Sessions
const KamburgaServices = require('kamburga-services');
// Initialize with your API key
const client = new KamburgaServices('your-api-key');
// Create a chat session
const chatSession = client.createChatSession()
.withModel('gpt-3.5-turbo')
.withMaxTokens(150)
.withTemperature(0.7);
// Add a system message
chatSession.addSystemMessage('You are a helpful assistant.');
// Send a message and get a response
async function chat() {
try {
const response = await chatSession.sendMessage('Hello, what can you do?');
console.log('Assistant:', response);
// Send another message in the same conversation
const response2 = await chatSession.sendMessage('Tell me more about that.');
console.log('Assistant:', response2);
} catch (error) {
console.error('Error:', error.message);
}
}
chat();API Reference
KamburgaServices
Constructor
const client = new KamburgaServices(apiKey, options);apiKey(string, required): Your Kamburga API keyoptions(object, optional):baseURL(string, optional): Base URL for the API (default: 'http://89.47.113.4:3022/api')
Methods
validateLicense(): Validate the API keygetExample(language): Get usage examples for a specific language (python, nodejs, curl)getConfig(): Get hosting configurationcreateChatSession(): Create a chat session for maintaining conversation history
Chat API
client.chat.completions.create(options)options(object):messages(array, required): Array of messages in the conversationmodel(string, optional): The model to use (default: 'gpt-3.5-turbo')max_tokens(number, optional): Maximum tokens to generate (default: 100)temperature(number, optional): Sampling temperature (default: 0.7)
Models API
client.models.list()
client.models.retrieve(modelId)License
MIT
