|
| 1 | +import fetch from 'node-fetch'; |
1 | 2 | import OpenAI from 'openai';
|
2 | 3 | import { RequestOptions } from 'openai/core';
|
3 | 4 | import {
|
@@ -340,7 +341,9 @@ export class OpenlayerClient {
|
340 | 341 | }
|
341 | 342 | );
|
342 | 343 |
|
343 |
| - const inferencePipeline = await createInferencePipelineResponse.json(); |
| 344 | + const inferencePipeline = (await createInferencePipelineResponse.json()) as |
| 345 | + | OpenlayerInferencePipeline |
| 346 | + | undefined; |
344 | 347 |
|
345 | 348 | if (!inferencePipeline?.id) {
|
346 | 349 | throw new Error('Error creating inference pipeline');
|
@@ -382,7 +385,11 @@ export class OpenlayerClient {
|
382 | 385 | method: 'POST',
|
383 | 386 | });
|
384 | 387 |
|
385 |
| - const data = await response.json(); |
| 388 | + const data = (await response.json()) as { |
| 389 | + error?: string; |
| 390 | + items?: OpenlayerProject[]; |
| 391 | + }; |
| 392 | + |
386 | 393 | const { items: projects, error } = data;
|
387 | 394 |
|
388 | 395 | if (!Array.isArray(projects)) {
|
@@ -431,7 +438,11 @@ export class OpenlayerClient {
|
431 | 438 | });
|
432 | 439 |
|
433 | 440 | const { items: inferencePipelines, error } =
|
434 |
| - await inferencePipelineResponse.json(); |
| 441 | + (await inferencePipelineResponse.json()) as { |
| 442 | + error?: string; |
| 443 | + items?: OpenlayerInferencePipeline[]; |
| 444 | + }; |
| 445 | + |
435 | 446 | const inferencePipeline = Array.isArray(inferencePipelines)
|
436 | 447 | ? inferencePipelines.find((p) => p.name === name)
|
437 | 448 | : undefined;
|
@@ -472,7 +483,10 @@ export class OpenlayerClient {
|
472 | 483 | });
|
473 | 484 |
|
474 | 485 | const data = await response.json();
|
475 |
| - const { items: projects, error } = data; |
| 486 | + const { items: projects, error } = data as { |
| 487 | + error?: string; |
| 488 | + items?: OpenlayerProject[]; |
| 489 | + }; |
476 | 490 |
|
477 | 491 | if (!Array.isArray(projects)) {
|
478 | 492 | throw new Error(
|
|
0 commit comments