File tree Expand file tree Collapse file tree 3 files changed +30
-0
lines changed
examples/nodejs/examples/pipes Expand file tree Collapse file tree 3 files changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ import 'dotenv/config' ;
2+ import { Pipe } from 'langbase' ;
3+
4+ const pipe = new Pipe ( {
5+ apiKey : process . env . LANGBASE_API_KEY ! ,
6+ } ) ;
7+
8+ async function main ( ) {
9+ const response = await pipe . list ( ) ;
10+ console . log ( response ) ;
11+ }
12+
13+ main ( ) ;
Original file line number Diff line number Diff line change @@ -57,6 +57,14 @@ export class Request {
5757 await this . handleErrorResponse ( { response} ) ;
5858 }
5959
60+ if ( ! options . body ) {
61+ return this . handleGenerateResponse ( {
62+ response,
63+ isChat : false ,
64+ threadId : null ,
65+ } )
66+ }
67+
6068 const threadId = response . headers . get ( 'lb-thread-id' ) ;
6169
6270 if ( options . body . stream ) {
Original file line number Diff line number Diff line change @@ -151,6 +151,8 @@ interface BaseResponse {
151151 status : 'public' | 'private' ;
152152 owner_login : string ;
153153 url : string ;
154+ type : 'chat' | 'generate' | 'run' ;
155+ api_key : string ;
154156}
155157
156158export interface CreateOptions extends BaseOptions { }
@@ -167,6 +169,7 @@ export class Pipe {
167169 const baseUrl = 'https://api.langbase.com' ;
168170 this . request = new Request ( { apiKey : options . apiKey , baseUrl} ) ;
169171 this . pipeOptions = options ;
172+
170173 this . pipe = new PipeBaseAI ( {
171174 apiKey : options . apiKey , // Langbase API key
172175 name : options . name ?. trim ( ) || '' , // Pipe name
@@ -217,6 +220,12 @@ export class Pipe {
217220 body : options ,
218221 } ) ;
219222 }
223+
224+ async list ( ) {
225+ return this . request . get ( {
226+ endpoint : '/v1/pipes' ,
227+ } ) ;
228+ }
220229}
221230
222231/**
You can’t perform that action at this time.
0 commit comments