File tree Expand file tree Collapse file tree 5 files changed +32
-1
lines changed
packages/langbase/src/langbase Expand file tree Collapse file tree 5 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -6,3 +6,4 @@ LANGBASE_API_KEY=""
66# https://dashboard.exa.ai/api-keys
77EXA_API_KEY = " "
88CRAWL_KEY = " "
9+ FIRECRAWL_KEY = " "
Original file line number Diff line number Diff line change 3333 "pipe.structured.outputs" : " npx tsx ./pipes/pipe.structured.outputs.ts" ,
3434 "tools.web-search" : " npx tsx ./tools/web-search.ts" ,
3535 "tools.crawl" : " npx tsx ./tools/crawl.ts" ,
36+ "tools.crawl.firecrawl" : " npx tsx ./tools/crawl.firecrawl.ts" ,
3637 "embed" : " npx tsx ./embed/index.ts" ,
3738 "chunker" : " npx tsx ./chunker/index.ts" ,
3839 "parser" : " npx tsx ./parser/index.ts" ,
Original file line number Diff line number Diff line change 1+ // Experimental upcoming beta AI primitve.
2+ // Please refer to the documentation for more information: https://langbase.com/docs for more information.
3+ import 'dotenv/config' ;
4+ import { Langbase } from 'langbase' ;
5+
6+ const langbase = new Langbase ( {
7+ apiKey : process . env . LANGBASE_API_KEY ! ,
8+ } ) ;
9+
10+ /**
11+ * Crawls specified URLs using firecrawl.dev service.
12+ *
13+ * Get your API key from the following link and set it in .env file.
14+ *
15+ * @link https://docs.firecrawl.dev/introduction
16+ */
17+ async function main ( ) {
18+ const results = await langbase . tools . crawl ( {
19+ url : [ 'https://langbase.com' , 'https://langbase.com/about' ] ,
20+ maxPages : 1 ,
21+ apiKey : process . env . FIRECRAWL_KEY ! ,
22+ service : 'firecrawl' ,
23+ } ) ;
24+
25+ console . log ( results ) ;
26+ }
27+
28+ main ( ) ;
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ async function main() {
1818 const results = await langbase . tools . crawl ( {
1919 url : [ 'https://langbase.com' , 'https://langbase.com/about' ] ,
2020 maxPages : 1 ,
21- apiKey : process . env . CRAWL_KEY ,
21+ apiKey : process . env . CRAWL_KEY ! ,
2222 } ) ;
2323
2424 console . log ( results ) ;
Original file line number Diff line number Diff line change @@ -394,6 +394,7 @@ export interface ToolCrawlOptions {
394394 url : string [ ] ;
395395 maxPages ?: number ;
396396 apiKey : string ;
397+ service ?: 'spider' | 'firecrawl' ;
397398}
398399
399400export interface ToolCrawlResponse {
You can’t perform that action at this time.
0 commit comments