@@ -41,7 +41,7 @@ const client = new LinkupClient({
41
41
});
42
42
```
43
43
44
- ### 📋 Examples
44
+ ### 📋 Search Endpoint
45
45
46
46
All search queries can be used with two very different modes:
47
47
@@ -51,7 +51,7 @@ All search queries can be used with two very different modes:
51
51
but it will be able to solve more complex queries (e.g. "What is the company profile of LangChain
52
52
accross the last few years, and how does it compare to its concurrents?")
53
53
54
- #### 📝 Standard Search Query
54
+ #### 📝 Example standard search query
55
55
56
56
``` typescript
57
57
import { LinkupClient } from ' linkup-js-sdk' ;
@@ -60,13 +60,39 @@ const client = new LinkupClient({
60
60
apiKey: ' <YOUR API KEY>' ,
61
61
});
62
62
63
- const askLinkup = async () => {
64
- return await client .search ({
65
- query: ' Can you tell me which women were awared the Physics Nobel Prize' ,
66
- depth: ' standard' ,
67
- outputType: ' sourcedAnswer' ,
68
- });
69
- };
63
+ const askLinkup = () => client .search ({
64
+ query: ' Can you tell me which women were awared the Physics Nobel Prize' ,
65
+ depth: ' standard' ,
66
+ outputType: ' sourcedAnswer' ,
67
+ });
68
+
69
+ askLinkup ()
70
+ .then (console .log );
71
+ .catch (console .error );
72
+ ```
73
+
74
+ ### ⬇️ Fetch Endpoint
75
+
76
+ You can use the fetch endpoint to retrieve the content of a given URL either in ` html ` or ` markdown ` format.
77
+
78
+ You can also use the ` renderJS ` flag to execute the JavaScript code of the page before returning the content.
79
+
80
+ #### 📝 Example
81
+
82
+ ``` typescript
83
+ import { LinkupClient } from ' linkup-js-sdk' ;
84
+
85
+ const client = new LinkupClient ({
86
+ apiKey: ' <YOUR API KEY>' ,
87
+ });
88
+
89
+ const fetchLinkup = async () => client .fetch ({
90
+ url: ' https://www.linkup.so' ,
91
+ outputFormat: ' html' ,
92
+ renderJS: true ,
93
+ });
70
94
71
- askLinkup ().then (console .log );
95
+ fetchLinkup ()
96
+ .then (console .log )
97
+ .catch (console .error );
72
98
```
0 commit comments