File tree Expand file tree Collapse file tree 4 files changed +34
-33
lines changed
Expand file tree Collapse file tree 4 files changed +34
-33
lines changed Original file line number Diff line number Diff line change @@ -20,13 +20,14 @@ export class APIError extends Error {
2020 super ( APIError . makeMessage ( status , error , message ) ) ;
2121 this . status = status ;
2222 this . headers = headers ;
23- this . request_id = headers ?. [ 'x -request-id' ] ;
23+ this . request_id = headers ?. [ 'lb -request-id' ] ;
2424
2525 const data = error as Record < string , any > ;
2626 this . error = data ;
2727 this . code = data ?. [ 'code' ] ;
28- this . param = data ?. [ 'param' ] ;
29- this . type = data ?. [ 'type' ] ;
28+ this . status = data ?. [ 'status' ] ;
29+ // this.param = data?.['param'];
30+ // this.type = data?.['type'];
3031 }
3132
3233 private static makeMessage (
Original file line number Diff line number Diff line change 1- import { Pipe , PipeOptions } from './pipes/pipes' ;
2-
3- class Langbase {
4- static pipe ( options : PipeOptions ) : Pipe {
5- return new Pipe ( options ) ;
6- }
7- }
8-
9- export default Langbase ;
1+ export { Pipe } from './pipes/pipes' ;
2+ export type { PipeOptions } from './pipes/pipes' ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ import 'dotenv/config' ;
2+ import { Pipe } from './../index' ;
3+
4+ async function main ( ) {
5+ const pipeLessWordy = new Pipe ( {
6+ apiKey : process . env . PIPE_LESS_WORDY ! ,
7+ } ) ;
8+
9+ const result = await pipeLessWordy . generateText ( {
10+ messages : [ { role : 'user' , content : 'Who is Ahmad Awais?' } ] ,
11+ } ) ;
12+
13+ console . log ( result . completion ) ;
14+
15+ const pipeLessWordyStream = new Pipe ( {
16+ apiKey : process . env . PIPE_LESS_WORDY_STREAM ! ,
17+ } ) ;
18+
19+ const stream = await pipeLessWordyStream . streamText ( {
20+ messages : [ { role : 'user' , content : 'Who is Ahmad Awais?' } ] ,
21+ } ) ;
22+
23+ for await ( const chunk of stream ) {
24+ process . stdout . write ( chunk . choices [ 0 ] ?. delta ?. content || '' ) ;
25+ }
26+ }
27+
28+ main ( ) ;
You can’t perform that action at this time.
0 commit comments