open-sauced / ai

Discover open-source projects on GitHub relevant to your skills (with ai).
https://opensauced.ai
MIT License
72 stars 30 forks source link

Add PR to OpenSauced Highlights button #12

Closed bdougie closed 1 year ago

bdougie commented 1 year ago

Similar interaction to the Gif for GitHub extension - Look at the end of the this post for context

Screen Shot 2023-04-17 at 6 51 13 AM

Proposed solution

Add a OpenSauced icon to the GitHub PR markdown editor. Generate copy based on commits and in the case of issue comments, generate a response to the comment.

This would be our first AI exploration @0-vortex, would love your thoughts.

0-vortex commented 1 year ago

screenshot is not loading 🍕

0-vortex commented 1 year ago

We could get the full code diff and send that to our API through authenticated request, along with some repo and user information; the api would do all the ai work and return some responses the user could implement in the highlight (or PR) description.

This is a very simplified version, IMHO would split this into PR description generator and highlight generator, depending on which models or LLM prompts are more successful in our internal testing, reading/understanding the code (this would be more useful in letting the extension help write PRs anywhere), or explaining the code (this would be more useful in creating highlights based on PRs anywhere).

Both versions would send very similar requests to the existing create highlights endpoints and we could start mirroring those backend routes with "suggestion" endpoints that take similar (more data tho) input and return a post suggestion for highlights that would then be adjusted or sent to the previously mentioned "addHighlightForUser" api route to create the highlight.

We can also take a hybrid approach to this and do the entire AI part in the chrome extension, taking an API key to run something like GPT4 with code analysis and prompt fine tuning via the extension.

Think we should explore the paths that help users the most 🍕

diivi commented 1 year ago

We decided today that all AI stuff will be handled by the extension itself, by interacting with 3rd party APIs. How we will do it (what data to send/what fine tuning to do) is what we will have to look into. ( #18 )

bdougie commented 1 year ago

We can mirror what AI commits is doing. Look through commit messages and identify a description.

https://github.com/Nutlope/aicommits

An alternative is looking at the code changes via the API and summarizing it using OpenAI's code features. Honestly ChatGPT-4 is also possible and does well.

I cover this in my blog series. Let me know if you are able to sign up for OpenAi and test locally. We could create a way for the user to authenticate or provide their own openai token.

bdougie commented 1 year ago

Group 7

Mock up of where the button will go.

Expectation is that you can add this PR as a highlight, only if you are the author (for now).

Anush008 commented 1 year ago

@bdougie, the flow I have in mind is, upon clicking the button you've mentioned above, a modal will be opened up for the user to enter the highlight title, description and post it. Along with the content length validations etc. Is that okay?

Anush008 commented 1 year ago

The modal styling can be based on the highlight edit modal of https://github.com/open-sauced/insights.

0-vortex commented 1 year ago

awesome initiative!!! first of all let me link a couple of resources i find essential to our long term ai wellbeing: https://github.com/Denis2054/Transformers-for-NLP-2nd-Edition and https://github.com/DataTalksClub/mlops-zoomcamp are my go-to resources for ai best practices with using huggingface as the github for ai

with these biases in place i believe the best way to approach this particular feature is to do:

[1] could be later used to train our own models and use for free in browser [2] can help with this but would need dataset or expectations set from [1]

this is just the "backend" part - a lot of work to get large language models to provide value to end users relies on ui interaction and in-flight prompt engineering, here some key factors I can suggest:

diivi commented 1 year ago

upon clicking the button you've mentioned above, a modal will be opened up for the user to enter the highlight title, description and post it. Along with the content length validations etc. Is that okay?

The basic flow should be that, yes. The brainstorming part of the PR is how AI should be integrated into the modal. We might need to do some research for that, but that might block development, I suggest we can get started with the modal and everything to add a highlight to OpenSauced, research AI integrations on the side, and integrate AI into the modal after we've made a decision.

bdougie commented 1 year ago

For adding a highlight from the extension we can just send the user to https://highlight.new, no that will need to link to a https://insights.opensauced.pizza/highlights/new page that has not been designed.

All AI considerations would be handled on the insights page and really just be gpt-4 providing a description for the highlight. But that is not need right now.

We can innovate after we add functionality.

No modal, just link to highlight.new

Anush008 commented 1 year ago

Hey @bdougie, can we have the redirect link accept the PR URL as a query param, so that the PR link is pre-filled on the https://insights.opensauced.pizza/highlight/new post page?

github-actions[bot] commented 1 year ago

:tada: This issue has been resolved in version 1.0.0-beta.8 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket:

github-actions[bot] commented 1 year ago

:tada: This issue has been resolved in version 1.0.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: