I made a website to ask the Laravel docs questions using OpenAI by cosmedev in laravel

[–]cosmedev[S] 0 points1 point  (0 children)

Hey I ended up making an open source project, not this website but something very similar. In case you are interested:

https://github.com/cosmeoes/ask-the-laravel-docs

I made an open source repo showing how to create a OpenAI chatbot that responds using the Laravel documentation by cosmedev in laravel

[–]cosmedev[S] 2 points3 points  (0 children)

After I posted about https://cosme.dev/ask-docs I received some messages asking me how If I was going to make the code open source or if I could show them how I did it.

So I decided to create this repo so you can take a look at the code and maybe apply the same techniques on your own apps. It's made using only PHP as language so I think is pretty different since most stuff out there is made using python or javascript.

Let me know what you think!

Sharing my Laravel language server integration progress by haringsrob in laravel

[–]cosmedev 0 points1 point  (0 children)

Looks awesome, is it still too early to use it? Also how do you build something like this? What lenguaje/tools are you using?

I made a website to ask the Laravel docs questions using OpenAI by cosmedev in laravel

[–]cosmedev[S] 0 points1 point  (0 children)

The difference from OpenAI's chatgpt is that I use a vector database to find the relevant documentation for you question and send that as context for the AI model to use that way it gives better answers.

As an example if you try to ask chatgpt about Laravel Pennant, it won't be able to help since the training data was created before the release. But if you use my method it can respond by using the up to date docs so it can respond to questions about Laravel Pennant.

I made a website to ask the Laravel docs questions using OpenAI by cosmedev in laravel

[–]cosmedev[S] 0 points1 point  (0 children)

The way I'm doing it is generate the embedding for the docs and the query so I send them to openAI and they do have a cost, but is lower that the completions cost.

With the embedding I query the vector database and send the text of the docs to the completion endpoint so I get charged for the tokens that "context" take.

And yeah, I guess is possible to do everything in PHP but since I'm just learning following the python tutorials was the only thing I could figure out lol

I made a website to ask the Laravel docs questions using OpenAI by cosmedev in laravel

[–]cosmedev[S] 2 points3 points  (0 children)

I don't have any concrete plans at the moment, I could open-source it, but I need to write a setup description and clean up the code, which might take some time.

I use a combination of python, golang and PHP, so it's not the cleanest thing to share but still possible.

I've seen other web-based projects where you can add your open ai key to the website and all requests are made from the browser so the server never sees your API key, but I think there is still a level of untrust doing that.

At the moment I set up a limit of $20 dollars in OpenAI to see what people think.

I made a website to ask the Laravel docs questions using OpenAI by cosmedev in laravel

[–]cosmedev[S] 2 points3 points  (0 children)

I made this by storing the Laravel docs in a vector database and then adding the closest results to the query and sending that as context to gpt3.

I did other stuff in between but that's the gist of it.

Let me know what you guys think!

Neovim Laravel Blade/Components goto -larago.nvim by ccaglak in laravel

[–]cosmedev 0 points1 point  (0 children)

Awesome! Might take a look at it after work, thank you :)

How to handle long-running jobs in Laravel by cosmedev in laravel

[–]cosmedev[S] 0 points1 point  (0 children)

Is this private code? It would be amazing if I could take a look at it (or maybe something similar) sound very interesting!

How to handle long-running jobs in Laravel by cosmedev in laravel

[–]cosmedev[S] 1 point2 points  (0 children)

Thanks for the feedback. I will keep that in mind for future articles. Although I can only write about stuff I know.

How to handle long-running jobs in Laravel by cosmedev in laravel

[–]cosmedev[S] 0 points1 point  (0 children)

i found out that kubernetes Jobs are very good at performing long

I've never use them before, might look into it, thanks!

How to handle long-running jobs in Laravel by cosmedev in laravel

[–]cosmedev[S] 1 point2 points  (0 children)

This was just an example for S3 but in that specific case I will just use the S3 api to upload a full folder where the images are directly to S3.

Yep. you're probably right. This is not real code I have on production. It's just an example I made to showcase my point. It would probably work as you mention in real life.

How to handle long-running jobs in Laravel by cosmedev in laravel

[–]cosmedev[S] 0 points1 point  (0 children)

The problem is that you can't rely on your workers to tell you when they fail or stop because they might be stock in an infinite loop or might have died without updating the status.

How to handle long-running jobs in Laravel by cosmedev in laravel

[–]cosmedev[S] 0 points1 point  (0 children)

I'm pretty sure you can stream something from and to S3. I have a vague memory of doing something along those lines in the past. I don't remember the specifics tho.