Skip to content

Commit

Permalink
Merge branch 'main' into recraft-ai
Browse files Browse the repository at this point in the history
  • Loading branch information
Ajay-Satish-01 authored Dec 24, 2024
2 parents f80d22e + 0041ff2 commit 83f3bd7
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 29 deletions.
4 changes: 2 additions & 2 deletions 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": "@portkey-ai/gateway",
"version": "1.8.5",
"version": "1.8.6",
"description": "A fast AI gateway by Portkey",
"repository": {
"type": "git",
Expand Down
6 changes: 3 additions & 3 deletions plugins/patronus/custom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export const handler: PluginHandler = async (
let verdict = false;
let data = null;

const evaluator = 'custom';
const profile = parameters.profile;
const evaluator = 'judge';
const criteria = parameters.criteria;

if (eventType !== 'afterRequestHook') {
return {
Expand All @@ -39,7 +39,7 @@ export const handler: PluginHandler = async (
evaluator,
parameters.credentials,
evaluationBody,
profile
criteria
);

const evalResult = result.results[0];
Expand Down
4 changes: 2 additions & 2 deletions plugins/patronus/globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const postPatronus = async (
evaluator: string,
credentials: any,
data: any,
profile: string | null = null
criteria: string | null = null
) => {
const options = {
headers: {
Expand All @@ -19,7 +19,7 @@ export const postPatronus = async (
{
evaluator: evaluator,
explain_strategy: 'always',
...(profile && { profile_name: profile }),
...(criteria && { criteria: criteria }),
},
],
evaluated_model_input: data.input,
Expand Down
6 changes: 3 additions & 3 deletions plugins/patronus/isConcise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export const handler: PluginHandler = async (
let verdict = false;
let data = null;

const evaluator = 'custom';
const profile = 'system:is-concise';
const evaluator = 'judge';
const criteria = 'patronus:is-concise';

if (eventType !== 'afterRequestHook') {
return {
Expand All @@ -39,7 +39,7 @@ export const handler: PluginHandler = async (
evaluator,
parameters.credentials,
evaluationBody,
profile
criteria
);

const evalResult = result.results[0];
Expand Down
6 changes: 3 additions & 3 deletions plugins/patronus/isHelpful.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export const handler: PluginHandler = async (
let verdict = false;
let data = null;

const evaluator = 'custom';
const profile = 'system:is-helpful';
const evaluator = 'judge';
const criteria = 'patronus:is-helpful';

if (eventType !== 'afterRequestHook') {
return {
Expand All @@ -39,7 +39,7 @@ export const handler: PluginHandler = async (
evaluator,
parameters.credentials,
evaluationBody,
profile
criteria
);

const evalResult = result.results[0];
Expand Down
6 changes: 3 additions & 3 deletions plugins/patronus/isPolite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export const handler: PluginHandler = async (
let verdict = false;
let data = null;

const evaluator = 'custom';
const profile = 'system:is-polite';
const evaluator = 'judge';
const criteria = 'patronus:is-polite';

if (eventType !== 'afterRequestHook') {
return {
Expand All @@ -39,7 +39,7 @@ export const handler: PluginHandler = async (
evaluator,
parameters.credentials,
evaluationBody,
profile
criteria
);

const evalResult = result.results[0];
Expand Down
6 changes: 3 additions & 3 deletions plugins/patronus/noApologies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export const handler: PluginHandler = async (
let verdict = false;
let data = null;

const evaluator = 'custom';
const profile = 'system:no-apologies';
const evaluator = 'judge';
const criteria = 'patronus:no-apologies';

if (eventType !== 'afterRequestHook') {
return {
Expand All @@ -39,7 +39,7 @@ export const handler: PluginHandler = async (
evaluator,
parameters.credentials,
evaluationBody,
profile
criteria
);

const evalResult = result.results[0];
Expand Down
6 changes: 3 additions & 3 deletions plugins/patronus/noGenderBias.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export const handler: PluginHandler = async (
let verdict = false;
let data = null;

const evaluator = 'custom';
const profile = 'system:no-gender-bias';
const evaluator = 'judge';
const criteria = 'patronus:no-gender-bias';

if (eventType !== 'afterRequestHook') {
return {
Expand All @@ -39,7 +39,7 @@ export const handler: PluginHandler = async (
evaluator,
parameters.credentials,
evaluationBody,
profile
criteria
);

const evalResult = result.results[0];
Expand Down
6 changes: 3 additions & 3 deletions plugins/patronus/noRacialBias.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export const handler: PluginHandler = async (
let verdict = false;
let data = null;

const evaluator = 'custom';
const profile = 'system:no-racial-bias';
const evaluator = 'judge';
const criteria = 'patronus:no-racial-bias';

if (eventType !== 'afterRequestHook') {
return {
Expand All @@ -39,7 +39,7 @@ export const handler: PluginHandler = async (
evaluator,
parameters.credentials,
evaluationBody,
profile
criteria
);

const evalResult = result.results[0];
Expand Down
10 changes: 8 additions & 2 deletions plugins/patronus/patronus.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,10 @@ describe('custom handler (is-concise)', () => {
},
};

const parameters = { credentials: testCreds, profile: 'system:is-concise' };
const parameters = {
credentials: testCreds,
criteria: 'patronus:is-concise',
};

const result = await customHandler(context, parameters, eventType);
console.log(result);
Expand All @@ -256,7 +259,10 @@ describe('custom handler (is-concise)', () => {
},
};

const parameters = { credentials: testCreds, profile: 'system:is-concise' };
const parameters = {
credentials: testCreds,
criteria: 'patronus:is-concise',
};

const result = await customHandler(context, parameters, eventType);
console.log(result);
Expand Down
2 changes: 1 addition & 1 deletion plugins/patronus/retrievalAnswerRelevance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const handler: PluginHandler = async (
let verdict = false;
let data = null;

const evaluator = 'retrieval-answer-relevance';
const evaluator = 'answer-relevance';

if (eventType !== 'afterRequestHook') {
return {
Expand Down

0 comments on commit 83f3bd7

Please sign in to comment.