Skip to content
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

Summarization model #19

Conversation

Samiul-TheSoccerFan
Copy link
Collaborator

Summary

Adding Summarization model

Checklist

Delete any items that are not applicable to this PR.

Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release.

When forming the risk matrix, consider some of the following examples and how they may potentially impact the change:

Risk Probability Severity Mitigation/Notes
Multiple Spaces—unexpected behavior in non-default Kibana Space. Low High Integration tests will verify that all features are still supported in non-default Kibana Space and when user switches between spaces.
Multiple nodes—Elasticsearch polling might have race conditions when multiple Kibana nodes are polling for the same tasks. High Low Tasks are idempotent, so executing them multiple times will not result in logical error, but will degrade performance. To test for this case we add plenty of unit tests around this logic and document manual testing procedure.
Code should gracefully handle cases when feature X or plugin Y are disabled. Medium High Unit tests will verify that any feature flag or plugin combination still results in our service operational.
See more potential risk examples

For maintainers

@Samiul-TheSoccerFan Samiul-TheSoccerFan marked this pull request as ready for review February 23, 2024 15:45

export const OpenAISummarizationModel: React.FC<OpenAISummarizationModelProps> = ({ model, onSelect, openAIFlyOutOpen }) => {

const [selectedModel, setSelectedModel] = useState(model ?? SummarizationModelName.gpt3_5_turbo_1106);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useState is redundant here
useForm is taking a role of useState for us

gpt3_5_turbo = 'gpt-3.5-turbo-instruct',
}

const Summarization_Model: EuiSuperSelectOption<string>[] = [
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can simplify all of this things.
All summarization models are an array, and just can be mapped before rendering. Will looks more native and simpe

}
>
<EuiSuperSelect
options={Summarization_Model}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here you can use models.map((model) => ({value: model, inputDisplay: <EuiFlexGroup...}))

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before I make the changes, I want to clarify if this is something is encourage in Elastic?
The reason is that, under the hood, it is essentially the same thing. By creating a string array and render each element in the options or I can utilize typescript to create the array and plug in within the component.

Please let me know if you still feels strongly against it, I will push the changes or will change it in my next PR.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It mostly to keep thing simple and avoid copypasting things and make it more complex and specific to our needs.
Anyway this solution is working so it up to you to apply or not this changes :)
Imagine we gonna add few more model, it will be just a new elements of array. If this elements will have another icon we don't need to create another render for it, we just will put icon as a new param and so on.

Copy link
Collaborator Author

@Samiul-TheSoccerFan Samiul-TheSoccerFan Feb 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it. My idea was based on a single icon but not with multiple icons. I will do some research in the code base and update in my next PR if needed

gpt3_5_turbo = 'gpt-3.5-turbo-instruct',
}

const Summarization_Model: EuiSuperSelectOption<string>[] = [
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And small things the naming of const and values suppose to follow CamelCase or camelCase format

<EuiSuperSelect
options={Summarization_Model}
valueOfSelected={selectedModel}
onChange={(value) => onChange(value)}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: not necessary to create new function here
onChange={onChange} is enough

@Samiul-TheSoccerFan Samiul-TheSoccerFan merged commit 7072aa8 into yansavitski:ai-playground Feb 23, 2024
1 check passed
@Samiul-TheSoccerFan Samiul-TheSoccerFan deleted the summarizatioMmodel branch February 23, 2024 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants