@blaxel/vercel 0.2.23-dev.174 → 0.2.23

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/dist/model.js CHANGED
@@ -17,49 +17,72 @@ const blModel = async (model, options) => {
17
17
  await (0, core_1.authenticate)();
18
18
  const type = modelData?.spec?.runtime?.type || "openai";
19
19
  const modelId = modelData?.spec?.runtime?.model || "gpt-4o";
20
+ // Custom fetch function that refreshes authentication on each request
21
+ const authenticatedFetch = async (input, init) => {
22
+ await (0, core_1.authenticate)();
23
+ const headers = {
24
+ ...init?.headers,
25
+ ...core_1.settings.headers,
26
+ };
27
+ return fetch(input, {
28
+ ...init,
29
+ headers,
30
+ });
31
+ };
20
32
  try {
21
33
  if (type === "gemini") {
22
34
  return (0, google_1.createGoogleGenerativeAI)({
23
- apiKey: core_1.settings.token,
24
- headers: core_1.settings.headers,
25
- fetch: (_, options) => {
26
- return fetch(`${url}/v1beta/models/${modelId}:generateContent`, options);
35
+ apiKey: "replaced",
36
+ fetch: async (_, options) => {
37
+ await (0, core_1.authenticate)();
38
+ const headers = {
39
+ ...options?.headers,
40
+ ...core_1.settings.headers,
41
+ };
42
+ return fetch(`${url}/v1beta/models/${modelId}:generateContent`, {
43
+ ...options,
44
+ headers,
45
+ });
27
46
  },
28
47
  ...options,
29
48
  })(modelId);
30
49
  }
31
50
  else if (type === "anthropic") {
32
51
  return (0, anthropic_1.createAnthropic)({
33
- apiKey: core_1.settings.token,
52
+ apiKey: "replaced",
34
53
  baseURL: `${url}/v1`,
35
- headers: core_1.settings.headers,
54
+ fetch: authenticatedFetch,
36
55
  ...options,
37
56
  })(modelId);
38
57
  }
39
58
  else if (type === "groq") {
40
59
  return (0, groq_1.createGroq)({
41
- apiKey: core_1.settings.token,
60
+ apiKey: "replaced",
42
61
  baseURL: `${url}`,
62
+ fetch: authenticatedFetch,
43
63
  ...options,
44
64
  })(modelId);
45
65
  }
46
66
  else if (type === "cerebras") {
47
67
  return (0, cerebras_1.createCerebras)({
48
- apiKey: core_1.settings.token,
68
+ apiKey: "replaced",
49
69
  baseURL: `${url}/v1`,
70
+ fetch: authenticatedFetch,
50
71
  ...options,
51
72
  })(modelId);
52
73
  }
53
74
  else if (type === "cohere") {
54
75
  return (0, cohere_1.createCohere)({
55
- apiKey: core_1.settings.token,
76
+ apiKey: "replaced",
56
77
  baseURL: `${url}/v2`,
78
+ fetch: authenticatedFetch,
57
79
  ...options,
58
80
  })(modelId);
59
81
  }
60
82
  return (0, openai_1.createOpenAI)({
61
- apiKey: core_1.settings.token,
83
+ apiKey: "replaced",
62
84
  baseURL: `${url}/v1`,
85
+ fetch: authenticatedFetch,
63
86
  ...options,
64
87
  })(modelId);
65
88
  }
package/dist/tools.js CHANGED
@@ -8,6 +8,7 @@ const blTool = async (name, ms) => {
8
8
  const toolFormated = {};
9
9
  const blaxelTool = await (0, core_1.getTool)(name, ms);
10
10
  for (const t of blaxelTool) {
11
+ // @ts-ignore - Type instantiation depth issue with ai package in some environments
11
12
  const toolInstance = (0, ai_1.tool)({
12
13
  description: t.description,
13
14
  parameters: t.inputSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blaxel/vercel",
3
- "version": "0.2.23-dev.174",
3
+ "version": "0.2.23",
4
4
  "description": "Blaxel SDK for TypeScript",
5
5
  "license": "MIT",
6
6
  "author": "Blaxel, INC (https://blaxel.ai)",
@@ -60,13 +60,13 @@
60
60
  "@ai-sdk/groq": "^1.2.8",
61
61
  "@ai-sdk/openai": "^1.3.21",
62
62
  "ai": "^4.3.13",
63
- "@blaxel/core": "0.2.23-dev.174"
63
+ "@blaxel/core": "0.2.23"
64
64
  },
65
65
  "devDependencies": {
66
66
  "@eslint/js": "^9.26.0",
67
67
  "@types/ws": "^8.18.1",
68
68
  "eslint": "^9.27.0",
69
- "typescript": "^5.0.0",
69
+ "typescript": "^5.6.3",
70
70
  "typescript-eslint": "^8.31.1"
71
71
  },
72
72
  "scripts": {