Skip to content

Commit

Permalink
reduce the number of ppl results to sample
Browse files Browse the repository at this point in the history
Signed-off-by: Yulong Ruan <ruanyl@amazon.com>
  • Loading branch information
ruanyl committed Jun 3, 2024
1 parent 0c6fe4f commit bb8a475
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 905 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@
},
"dependencies": {
"@aws-crypto/client-node": "^3.1.1",
"@aws-sdk/client-bedrock-runtime": "^3.575.0",
"@elastic/datemath": "5.0.3",
"@elastic/eui": "npm:@opensearch-project/oui@1.5.1",
"@elastic/good": "^9.0.1-kibana3",
Expand Down Expand Up @@ -237,7 +236,7 @@
"uuid": "3.3.2",
"whatwg-fetch": "^3.0.0",
"yauzl": "^2.10.0"

},
"devDependencies": {
"@babel/core": "^7.22.9",
Expand Down
14 changes: 11 additions & 3 deletions src/plugins/vis_type_vega/public/text_to_vega.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import { BehaviorSubject, Observable } from 'rxjs';

Check failure on line 1 in src/plugins/vis_type_vega/public/text_to_vega.ts

View workflow job for this annotation

GitHub Actions / Build and Verify on Linux (ciGroup1)

File must start with a license header
import { debounceTime, distinctUntilChanged, switchMap, tap, filter } from 'rxjs/operators';
import {
debounceTime,
distinctUntilChanged,
switchMap,
tap,
filter,
finalize,
} from 'rxjs/operators';
import { HttpSetup } from 'opensearch-dashboards/public';

const topN = (ppl: string, n: number) => `${ppl} | head ${n}`;
Expand Down Expand Up @@ -63,7 +70,7 @@ export class Text2Vega {
if (value instanceof Error) {
return value;
}
const ppl = topN(value.ppl, 5);
const ppl = topN(value.ppl, 2);
const sample = await this.http.post('/api/ppl/search', {
body: JSON.stringify({ query: ppl, format: 'jdbc' }),
});
Expand All @@ -83,7 +90,8 @@ export class Text2Vega {
};
return result;
}),
tap(() => llmRunning$.next(false))
tap(() => llmRunning$.next(false)),
finalize(() => llmRunning$.next(false))
);
}

Expand Down
1 change: 0 additions & 1 deletion src/plugins/vis_type_vega/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
*/

import { schema } from '@osd/config-schema';
import { BedrockRuntimeClient, InvokeModelCommand } from '@aws-sdk/client-bedrock-runtime';
import { PluginInitializerContext, CoreSetup, CoreStart, Plugin } from '../../../core/server';
import { registerVegaUsageCollector } from './usage_collector';
import {
Expand Down
Loading

0 comments on commit bb8a475

Please sign in to comment.