Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

tako-sdk

Package Overview
Dependencies
Maintainers
3
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tako-sdk

JavaScript/TypeScript SDK for the Tako API

latest
npmnpm
Version
0.1.5
Version published
Weekly downloads
6
-66.67%
Maintainers
3
Weekly downloads
 
Created
Source

Tako SDK

A lightweight TypeScript SDK for the Tako API.

Installation

npm install tako-sdk
# or
yarn add tako-sdk
# or
pnpm add tako-sdk

Quick Start

import { createTakoClient } from 'tako-sdk';

// Initialize the client
const tako = createTakoClient(process.env.TAKO_API_KEY!);

// Search Tako Knowledge
const results = await tako.knowledgeSearch('AMD vs. Nvidia headcount since 2015');
console.log(results.outputs.knowledge_cards);

Usage Example: Next.js API Route (App Router)

// app/api/tako-search/route.ts
import { createTakoClient } from 'tako-sdk';
import { NextResponse } from 'next/server';

export async function POST(request: Request) {
  const { query, sourceIndexes } = await request.json();
  const tako = createTakoClient(process.env.TAKO_API_KEY!);
  
  try {
    const results = await tako.knowledgeSearch(query, sourceIndexes);
    return NextResponse.json(results);
  } catch (error: any) {
    return NextResponse.json(
      { error: error.message || 'An error occurred' },
      { status: error.status || 500 }
    );
  }
}

API Reference

createTakoClient(apiKey)

Creates a new Tako API client.

const tako = createTakoClient('your-api-key');

Parameters:

  • apiKey (string): Your Tako API key

takoClient.knowledgeSearch(text, sourceIndexes?)

Search Tako Knowledge using natural language.

const results = await tako.knowledgeSearch('AMD vs. Nvidia headcount since 2015');

Parameters:

  • text (string): The natural language query text
  • sourceIndexes (SourceIndex[], optional): Array of source indexes to search within. Available values: SourceIndex.TAKO or SourceIndex.WEB

Returns: Promise<KnowledgeSearchResponse>

The response contains an array of knowledge cards in the outputs.knowledge_cards field. Each knowledge card contains:

  • card_id: Unique identifier for the card
  • title: Card title
  • description: Detailed description of the card's content
  • webpage_url: URL of a webpage hosting the interactive knowledge card
  • image_url: URL of a static image of the knowledge card
  • embed_url: URL of an embeddable iframe of the knowledge card
  • sources: The sources of the knowledge card
  • methodologies: The methodologies of the knowledge card

For detailed API response types and subfield structure, see the Tako API Documentation.

Error Handling

The SDK throws typed exceptions for different errors:

import { 
  TakoException,
  TakoUnauthorizedException,
  TakoRateLimitException,
} from 'tako-sdk';

try {
  const results = await tako.knowledgeSearch(query);
} catch (error) {
  if (error instanceof TakoUnauthorizedException) {
    console.error('Authentication error:', error.message);
  } else if (error instanceof TakoRateLimitException) {
    console.error('Rate limit exceeded:', error.message);
  } else if (error instanceof TakoNotFoundException) {
    console.error('Resource not found:', error.message);
  } else if (error instanceof TakoException) {
    console.error('API error:', error.message);
  } else {
    console.error('Unexpected error:', error);
  }
}

Each exception includes:

  • status: HTTP status code
  • message: Error message
  • details: Additional error details from the API (if available)

Keywords

tako

FAQs

Package last updated on 16 Jun 2025

Did you know?

Socket

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.

Install

Related posts