Skip to content

Commit 3bc02bf

Browse files
committed
Updated docs for logs
1 parent 9483add commit 3bc02bf

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

README.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ This package provides an easy way to use the [Langflow API](https://docs.datasta
2222
- [File upload](#file-upload)
2323
- [Logs](#logs)
2424
- [Fetching the logs](#fetching-the-logs)
25+
- [Streaming the logs](#streaming-the-logs)
2526
- [Aborting requests](#aborting-requests)
2627
- [Contributing](#contributing)
2728

@@ -91,6 +92,8 @@ const osLangflowClient = new LangflowClient({ baseUrl, apiKey });
9192

9293
### Running a flow
9394

95+
[Langflow documentation for running a flow](https://docs.langflow.org/api/simplified-run-flow).
96+
9497
Once you have a client, you can create a reference to a flow using the `flowID`. This can be found in the API modal in Langflow.
9598

9699
```js
@@ -193,6 +196,8 @@ There's more [documentation and examples of a streaming response in the Langflow
193196

194197
### File upload
195198

199+
[Langflow documentation for file upload API](https://docs.langflow.org/api/upload-file-1).
200+
196201
Chat input components support files as input as well as text. You need to upload your file first, using the file upload function, then provide the file path to the flow as a tweak.
197202

198203
```js
@@ -210,18 +215,31 @@ const response = await flow.tweak("ChatInput-abcd": { files: file.filePath }).ru
210215
211216
### Logs
212217

218+
[Langflow documentation for the logs API](https://docs.langflow.org/api/logs).
219+
213220
#### Fetching the logs
214221

215-
You can fetch the logs for the your Langflow instance. You can either fetch the logs.
222+
You can fetch the logs for the your Langflow instance.
216223

217224
```js
218225
const logs = await client.logs.fetch();
219226
```
220227

221-
Or stream the logs:
228+
When fetching the logs, you can pass a `timestamp` and either a number of `lines_before` or `lines_after` the timestamp. For example, the following code will get the 10 log lines that happened after 1 hour ago:
229+
230+
```js
231+
const logs = await client.logs.fetch({
232+
timestamp: Date.now() - 60 * 60 * 1000,
233+
lines_after: 10,
234+
});
235+
```
236+
237+
#### Streaming the logs
238+
239+
You can also stream the logs by requesting the [streaming endpoint](https://docs.langflow.org/api/stream-logs).
222240

223241
```js
224-
for await (const log of client.logs.stream()) {
242+
for await (const log of await client.logs.stream()) {
225243
console.log(log);
226244
}
227245
```

0 commit comments

Comments
 (0)