tako-sdk 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -25,9 +25,7 @@ const results = await tako.knowledgeSearch('AMD vs. Nvidia headcount since 2015'
25
25
  console.log(results.outputs.knowledge_cards);
26
26
  ```
27
27
 
28
- ## Usage Examples
29
-
30
- ### Next.js API Route (App Router)
28
+ ### Usage Example: Next.js API Route (App Router)
31
29
 
32
30
  ```typescript
33
31
  // app/api/tako-search/route.ts
@@ -50,34 +48,9 @@ export async function POST(request: Request) {
50
48
  }
51
49
  ```
52
50
 
53
- ### Edge API Route
54
-
55
- ```typescript
56
- // app/api/tako-edge/route.ts
57
- import { createTakoClient } from 'tako-sdk';
58
- import { NextResponse } from 'next/server';
59
-
60
- export const runtime = 'edge';
61
-
62
- export async function POST(request: Request) {
63
- const { query, sourceIndexes } = await request.json();
64
- const tako = createTakoClient(process.env.TAKO_API_KEY!);
65
-
66
- try {
67
- const results = await tako.knowledgeSearch(query, sourceIndexes);
68
- return NextResponse.json(results);
69
- } catch (error: any) {
70
- return NextResponse.json(
71
- { error: error.message || 'An error occurred' },
72
- { status: error.status || 500 }
73
- );
74
- }
75
- }
76
- ```
77
-
78
51
  ## API Reference
79
52
 
80
- ### `createTakoClient(apiKey, baseUrl?)`
53
+ ### `createTakoClient(apiKey)`
81
54
 
82
55
  Creates a new Tako API client.
83
56
 
@@ -87,7 +60,6 @@ const tako = createTakoClient('your-api-key');
87
60
 
88
61
  Parameters:
89
62
  - `apiKey` (string): Your Tako API key
90
- - `baseUrl` (string, optional): Override the default API base URL
91
63
 
92
64
  ### `takoClient.knowledgeSearch(text, sourceIndexes?)`
93
65
 
@@ -103,13 +75,6 @@ Parameters:
103
75
 
104
76
  Returns: `Promise<KnowledgeSearchResponse>`
105
77
 
106
- ## Examples
107
-
108
- The SDK includes several examples in the `examples/` directory:
109
-
110
- - `edge-api-route.ts` - Edge Runtime API route example
111
- - `next-api-route.ts` - Standard Next.js API route example
112
-
113
78
  ## Error Handling
114
79
 
115
80
  The SDK throws typed errors with status codes and messages:
package/dist/index.cjs CHANGED
@@ -63,27 +63,16 @@ var TakoClient = class {
63
63
  headers,
64
64
  body: body ? JSON.stringify(body) : void 0
65
65
  };
66
- try {
67
- const response = await fetch(url, options);
68
- if (!response.ok) {
69
- const errorData = await response.json();
70
- throw {
71
- status: response.status,
72
- message: errorData.message || response.statusText,
73
- details: errorData
74
- };
75
- }
76
- return await response.json();
77
- } catch (error) {
78
- if (error.status) {
79
- throw error;
80
- }
66
+ const response = await fetch(url, options);
67
+ if (!response.ok) {
68
+ const errorData = await response.json();
81
69
  throw {
82
- status: 500,
83
- message: "Network error",
84
- details: error
70
+ status: response.status,
71
+ message: errorData.message || response.statusText,
72
+ details: errorData
85
73
  };
86
74
  }
75
+ return await response.json();
87
76
  }
88
77
  /**
89
78
  * Search Tako Knowledge using natural language
package/dist/index.js CHANGED
@@ -36,27 +36,16 @@ var TakoClient = class {
36
36
  headers,
37
37
  body: body ? JSON.stringify(body) : void 0
38
38
  };
39
- try {
40
- const response = await fetch(url, options);
41
- if (!response.ok) {
42
- const errorData = await response.json();
43
- throw {
44
- status: response.status,
45
- message: errorData.message || response.statusText,
46
- details: errorData
47
- };
48
- }
49
- return await response.json();
50
- } catch (error) {
51
- if (error.status) {
52
- throw error;
53
- }
39
+ const response = await fetch(url, options);
40
+ if (!response.ok) {
41
+ const errorData = await response.json();
54
42
  throw {
55
- status: 500,
56
- message: "Network error",
57
- details: error
43
+ status: response.status,
44
+ message: errorData.message || response.statusText,
45
+ details: errorData
58
46
  };
59
47
  }
48
+ return await response.json();
60
49
  }
61
50
  /**
62
51
  * Search Tako Knowledge using natural language
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tako-sdk",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "JavaScript/TypeScript SDK for the Tako API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",