Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.

Commit

Permalink
Merge pull request #41 from SciPhi-AI/Nolan/UpdateStream
Browse files Browse the repository at this point in the history
Nolan/update stream
  • Loading branch information
NolanTrem committed Jul 20, 2024
2 parents 68fc1ff + d11bba3 commit cc3b268
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 21 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "r2r-js",
"version": "1.2.4",
"version": "1.2.5",
"description": "",
"main": "dist/index.js",
"browser": "dist/index.browser.js",
Expand Down
30 changes: 11 additions & 19 deletions src/r2rClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -479,30 +479,22 @@ export class r2rClient {
@feature("streamingRag")
private async streamRag(
request: R2RRAGRequest,
): Promise<ReadableStream<Uint8Array> | null> {
): Promise<ReadableStream<Uint8Array>> {
this._ensureAuthenticated();

const response = await this._makeRequest<ReadableStream<Uint8Array> | null>(
"POST",
"rag",
{
data: request,
headers: {
"Content-Type": "application/json",
},
responseType: "stream",
returnFullResponse: true,
const response = await this._makeRequest<Response>("POST", "rag", {
data: request,
headers: {
"Content-Type": "application/json",
},
);
responseType: "stream",
returnFullResponse: true,
});

if (
response &&
(response as any).status >= 200 &&
(response as any).status < 300
) {
return (response as any).data;
if (response.status >= 200 && response.status < 300) {
return response.body as ReadableStream<Uint8Array>;
} else {
throw new Error(`HTTP error! status: ${(response as any).status}`);
throw new Error(`HTTP error! status: ${response.status}`);
}
}

Expand Down

0 comments on commit cc3b268

Please sign in to comment.