File tree Expand file tree Collapse file tree 6 files changed +8
-8
lines changed
Expand file tree Collapse file tree 6 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -5,10 +5,10 @@ export async function POST(req: Request) {
55 const { prompt} = await req . json ( ) ;
66
77 // 1. Initiate the Pipe.
8- const pipe = new Pipe ( { apiKey : process . env . LANGBASE_PIPE_LESS_WORDY ! } ) ;
8+ const myPipe = new Pipe ( { apiKey : process . env . LANGBASE_PIPE_LESS_WORDY ! } ) ;
99
1010 // 3. Generate the text by asking a question.
11- const result = await pipe . generateText ( {
11+ const result = await myPipe . generateText ( {
1212 // Add user question prompt here to generate completion.
1313 messages : [ { role : 'user' , content : prompt } ] ,
1414 } ) ;
Original file line number Diff line number Diff line change @@ -7,12 +7,12 @@ export async function POST(req: NextRequest) {
77 const { prompt} = await req . json ( ) ;
88
99 // 1. Initiate the Pipe.
10- const pipe = new Pipe ( {
10+ const myPipe = new Pipe ( {
1111 apiKey : process . env . LANGBASE_PIPE_LESS_WORDY ! ,
1212 } ) ;
1313
1414 // 2. Generate a stream by asking a question
15- const stream = await pipe . streamText ( {
15+ const { stream} = await myPipe . streamText ( {
1616 messages : [ { role : 'user' , content : prompt } ] ,
1717 } ) ;
1818
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ export default function GenerateTextExample() {
1515
1616 setLoading ( true ) ;
1717 try {
18- const response = await fetch ( '/api/ langbase/pipe/generate-text' , {
18+ const response = await fetch ( '/langbase/pipe/generate-text' , {
1919 method : 'POST' ,
2020 headers : {
2121 'Content-Type' : 'application/json' ,
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ export default function StreamTextExample() {
1919 setCompletion ( '' ) ;
2020
2121 try {
22- const response = await fetch ( '/api/ langbase/pipe/stream-text' , {
22+ const response = await fetch ( '/langbase/pipe/stream-text' , {
2323 method : 'POST' ,
2424 body : JSON . stringify ( { prompt} ) ,
2525 headers : { 'Content-Type' : 'text/plain' } ,
Original file line number Diff line number Diff line change 1212 "@radix-ui/react-slot" : " ^1.1.0" ,
1313 "class-variance-authority" : " ^0.7.0" ,
1414 "clsx" : " ^2.1.1" ,
15- "langbase" : " * " ,
15+ "langbase" : " ^1.0.0 " ,
1616 "lucide-react" : " ^0.416.0" ,
1717 "mxcn" : " ^2.0.0" ,
1818 "next" : " 14.2.5" ,
Original file line number Diff line number Diff line change 1111 "license" : " UNLICENSED" ,
1212 "dependencies" : {
1313 "dotenv" : " ^16.4.5" ,
14- "langbase" : " * "
14+ "langbase" : " ^1.0.0 "
1515 }
1616}
You can’t perform that action at this time.
0 commit comments