TypeScript
SDK Reference
createTakoClient(apiKey)
Creates a new Tako API client.
Parameters:
apiKey
(string): Your Tako API key
takoClient.knowledgeSearch(text, sourceIndexes?)
Search Tako Knowledge using natural language.
Parameters:
text
(string): The natural language query textsourceIndexes
(SourceIndex[], optional): Array of source indexes to search within. Available values:SourceIndex.TAKO
orSourceIndex.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 cardtitle
: Card titledescription
: Detailed description of the card’s contentwebpage_url
: URL of a webpage hosting the interactive knowledge cardimage_url
: URL of a static image of the knowledge cardembed_url
: URL of an embeddable iframe of the knowledge cardsources
: The sources of the knowledge cardmethodologies
: 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:
Each exception includes:
status
: HTTP status codemessage
: Error messagedetails
: Additional error details from the API (if available)