This is the overridden Stream.fromSSEResponse
static method for the bedrock SDK
When an error event happens it throws APIError.generate
with the first parameter (the status code) being undefined
Which ends up creating an error class here
// Type for a value that might be a Promise | |
type MaybePromise<T> = T | Promise<T>; | |
// Async pipe with proper type inference for up to 10 functions | |
function asyncPipe<A, B>( | |
ab: (a: A) => MaybePromise<B> | |
): (a: A) => Promise<B>; | |
function asyncPipe<A, B, C>( | |
ab: (a: A) => MaybePromise<B>, |
// Type for a value that might be a Promise | |
type MaybePromise<T> = T | Promise<T>; | |
// Async compose with proper type inference for up to 10 functions | |
function asyncCompose<A, B>( | |
ab: (a: A) => MaybePromise<B> | |
): (a: A) => Promise<B>; | |
function asyncCompose<A, B, C>( | |
bc: (b: B) => MaybePromise<C>, |
import { S3Client, PutObjectCommand, GetObjectCommand, ListObjectsV2Command } from '@aws-sdk/client-s3'; | |
import { createHash } from 'crypto'; | |
// Types for our chat system | |
interface ChatMessage { | |
id: string; | |
timestamp: number; | |
role: 'user' | 'assistant'; | |
content: string; | |
metadata?: Record<string, any>; |
This is the overridden Stream.fromSSEResponse
static method for the bedrock SDK
When an error event happens it throws APIError.generate
with the first parameter (the status code) being undefined
Which ends up creating an error class here
This is the overridden Stream.fromSSEResponse
static method for the bedrock SDK
When an error event happens it throws APIError.generate
with the first parameter (the status code) being undefined
Which ends up creating an error class here
/* eslint-disable prefer-promise-reject-errors */ | |
/* eslint-disable compat/compat */ | |
import $ from 'jquery'; | |
import lumin from '../constants/lumin'; | |
const contentType = { 'Content-Type': 'application/json' }; | |
export const ajaxRequest = function ( | |
endpoint = '', | |
method = 'get', |
const promise = new Promise2((resolve, reject) => { | |
setTimeout(() => { | |
resolve('hello') | |
}, 500) | |
}) | |
promise.then((value) => { | |
console.log(value) | |
}) |