-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Adds portkey plugin #10337
base: develop
Are you sure you want to change the base?
feat: Adds portkey plugin #10337
Conversation
sarathsomana
commented
Jul 12, 2024
- Adds plugin for Portkey APIs
Code Review Agent Run #8e62e1
Code Review Overview
High-level FeedbackEnsure that sensitive information is not exposed through console logs by using a proper logging mechanism. Validate and sanitize inputs to prevent runtime errors and security vulnerabilities. Improve accessibility by adding titles and descriptions to SVG files. Mock dependencies in tests to ensure they are isolated and reliable.Detailed Feedback
📄 marketplace/plugins/portkey/lib/types.ts
Issues: Total - 1, High importance - 1
📄 marketplace/plugins/portkey/.gitignore
Issues: Total - 1, High importance - 1
📄 marketplace/plugins/portkey/lib/portkey_operations.ts
Issues: Total - 2, High importance - 2
📄 marketplace/plugins/portkey/lib/icon.svg
Issues: Total - 1, High importance - 1
📄 marketplace/plugins/portkey/lib/index.ts
Issues: Total - 2, High importance - 2
📄 marketplace/plugins/portkey/__tests__/index.js
Issues: Total - 1, High importance - 1
|
export type SourceOptions = { | ||
apiKey: string; | ||
virtualKey: string; | ||
config: Record<string, any>; | ||
}; | ||
|
||
// export type QueryOptions = { | ||
// operation: Operation; | ||
// prompt?: string; | ||
// max_tokens?: number | string; | ||
// temperature?: number | string; | ||
// stop_sequence?: [string]; | ||
// suffix?: string | null; | ||
// }; | ||
interface CredentialsBase { | ||
config?: Record<string, any> | null; | ||
virtualKey?: string | null; | ||
} | ||
export enum Operation { | ||
Completion = 'completion', | ||
Chat = 'chat', | ||
PromptCompletion = 'prompt_completion', | ||
CreateEmbedding = 'create_embedding', | ||
} | ||
interface CompletionQueryBase extends CredentialsBase { | ||
operation: Operation; | ||
model: string; | ||
temperature?: number | string; | ||
max_tokens?: number | string; | ||
stop_sequences?: string; | ||
metadata?: Record<string, any> | null; | ||
other_parameters?: Record<string, any> | null; | ||
} | ||
|
||
interface Message { | ||
role: string; | ||
content: string; | ||
} | ||
export interface ChatCompletionQueryOptions extends CompletionQueryBase { | ||
messages: Array<Message> | ||
} | ||
|
||
export interface TextCompletionQueryOptions extends CompletionQueryBase { | ||
prompt: string | ||
} | ||
|
||
export interface PromptCompletionQueryOptions extends CredentialsBase { | ||
operation: Operation; | ||
promptId: string; | ||
variables?: Record<string, any>; | ||
parameters?: Record<string, any>; | ||
metadata?: Record<string, any>; | ||
} | ||
|
||
export interface EmbeddingQueryOptions extends CredentialsBase { | ||
operation: Operation; | ||
input: string; | ||
model: string; | ||
metadata?: Record<string, any>; | ||
} | ||
|
||
export type QueryOptions = TextCompletionQueryOptions | ChatCompletionQueryOptions | PromptCompletionQueryOptions | EmbeddingQueryOptions; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bito Code Review Agent Run #8e62e1 - 07/12/2024, 12:45 am
Code suggestion
@@ -30,7 30,7 @@
interface CompletionQueryBase extends CredentialsBase {
operation: Operation;
model: string;
temperature?: number | string;
max_tokens?: number | string;
- stop_sequences?: string;
stop_sequences?: string[];
metadata?: Record<string, any> | null;
other_parameters?: Record<string, any> | null;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if string[] is parsed out of the box from text input of Tooljet, Hence using a string to parse manually.
Deployment: https://tooljet-pr-10337.onrender.com |
@mansukh-tj Please find a short demo of operations in the plugin here : https://www.loom.com/share/25f9db309b7141178f4437f150a1180e?sid=d24587e3-822a-4eff-bec9-d0e9887cac36 Do let me know if you require additional information to review this PR |
/review |
Code Review Agent Run #9e2d75
High-level FeedbackEnsure type safety by using generic type parameters and correct data types for fields. Validate and sanitize inputs to prevent potential issues. Consider adding unit tests to cover new functionalities and changes to ensure robustness and reliability. |
@akshaysasidrn Do let me know your suggestions on the PR. |
Deployment: https://tooljet-pr-10337.onrender.com |
Deployment: https://tooljet-pr-10337.onrender.com |