File tree Expand file tree Collapse file tree 2 files changed +17
-5
lines changed
packages/langbase/src/common Expand file tree Collapse file tree 2 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ async function main() {
1616 } ,
1717 ] ,
1818 stream : false ,
19- name : 'summary'
19+ name : 'email-sentiment' ,
2020 } ) ;
2121 console . log ( 'response: ' , response ) ;
2222}
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ interface HandleGenerateResponseParams {
3131 response : Response ;
3232 threadId : string | null ;
3333 rawResponse : boolean ;
34+ endpoint ?: string ;
3435}
3536
3637export class Request {
@@ -69,6 +70,7 @@ export class Request {
6970 response,
7071 threadId : null ,
7172 rawResponse : options . body ?. rawResponse ?? false ,
73+ endpoint,
7274 } ) ;
7375 }
7476
@@ -87,6 +89,7 @@ export class Request {
8789 response,
8890 threadId,
8991 rawResponse : options . body ?. rawResponse ?? false ,
92+ endpoint,
9093 } ) ;
9194 } else {
9295 const res = response . json ( ) ;
@@ -190,14 +193,23 @@ export class Request {
190193 response,
191194 threadId,
192195 rawResponse,
196+ endpoint,
193197 } : HandleGenerateResponseParams ) : Promise < any > {
198+ let isAgentRun = false ;
199+ if ( endpoint === '/v1/agent/run' ) isAgentRun = true ;
200+
194201 const generateResponse = await response . json ( ) ;
195202
196203 const buildResponse = generateResponse . raw
197- ? {
198- completion : generateResponse . completion ,
199- ...generateResponse . raw ,
200- }
204+ ? isAgentRun
205+ ? {
206+ output : generateResponse . output ,
207+ ...generateResponse . raw ,
208+ }
209+ : {
210+ completion : generateResponse . completion ,
211+ ...generateResponse . raw ,
212+ }
201213 : generateResponse ;
202214
203215 const result : any = {
You can’t perform that action at this time.
0 commit comments