Skip to main content

Getting Started with Tekimax SDK - GPT-OSS Edition

This guide will help you get up and running with the Tekimax SDK, optimized for GPT-OSS 20 and GPT-OSS 120 models.

Prerequisites

  • Node.js 16 or later
  • Ollama installed and running locally (or remote Ollama server accessible)
  • GPT-OSS 20 or GPT-OSS 120 models pulled in Ollama

Installation

Install the SDK using npm, yarn, or bun:
# Using npm
npm install tekimax-sdk

# Using yarn
yarn add tekimax-sdk

# Using bun
bun add tekimax-sdk

Quick Start

Basic Text Generation with GPT-OSS 20

import { OllamaClient } from 'tekimax-sdk';

const client = new OllamaClient();

async function generateText() {
  const response = await client.models.generate({
    model: 'gpt-oss-20', // or use 'gpt20' alias
    prompt: 'Explain how large language models work in simple terms',
  });
  
  console.log(response.response);
}

generateText();

Streaming Response with GPT-OSS 120

import { OllamaClient } from 'tekimax-sdk';

const client = new OllamaClient();

async function streamResponse() {
  const response = await client.models.generate({
    model: 'gpt-oss-120', // or use 'gpt120' or '120' alias
    prompt: 'Write a short story about a robot learning to paint',
    stream: true
  });
  
  // Process the stream
  const reader = response.body?.getReader();
  const decoder = new TextDecoder();
  
  while (true) {
    const { done, value } = await reader.read();
    if (done) break;
    const chunk = decoder.decode(value);
    const lines = chunk.split('\n').filter(line => line.trim());
    for (const line of lines) {
      const data = JSON.parse(line);
      process.stdout.write(data.response || '');
    }
  }
}

streamResponse();

Creating Embeddings with GPT-OSS

import { OllamaClient } from 'tekimax-sdk';

const client = new OllamaClient();

async function createEmbedding() {
  const embedding = await client.embeddings.create({
    model: 'gpt-oss-20', // Both models support embeddings
    input: 'This is a sentence I want to convert to a vector embedding',
  });
  
  console.log(`Embedding dimension: ${embedding.embeddings[0].length}`);
  console.log(`First few values: ${embedding.embeddings[0].slice(0, 5)}`);
}

createEmbedding();

Configuration

Custom Ollama Server

import { OllamaClient } from 'tekimax-sdk';

const client = new OllamaClient({
  baseUrl: 'http://your-ollama-server:11434',
});

Advanced Generation Options

import { OllamaClient } from 'tekimax-sdk';

const client = new OllamaClient();

async function advancedGeneration() {
  // GPT-OSS 120 has more advanced capabilities
  const response = await client.models.generate({
    model: 'gpt-oss-120',
    prompt: 'Write a poem about the ocean',
    system: 'You are a poet who specializes in nature poetry',
    temperature: 0.7,
    top_p: 0.9,
    top_k: 40,
    num_predict: 500, // GPT-OSS 120 supports longer outputs
    stop: ['END']
  });
  
  console.log(response.response);
}

// Show available models
async function listSupportedModels() {
  const models = client.models.getSupportedModels();
  console.log('Supported Models:', models);
  console.log('Default Model:', client.models.getDefaultModel());
}

advancedGeneration();
listSupportedModels();

Model Comparison

FeatureGPT-OSS 20GPT-OSS 120
Parameters20B120B
Context Length8,192 tokens32,768 tokens
Max Output4,096 tokens16,384 tokens
Fine-tuning
Embeddings
SpeedFasterSlower
QualityGoodExcellent

Next Steps