Live data from Hacker News

Show HN: GPT Repo Loader – load entire code repos into GPT prompts

github.com

141–150 of 162 posts

Re: Show HN: GPT Repo Loader – load entire code repos into GPT prompts

#141

Earlier quoted context omitted.

Maybe someone can correct me, but my understanding is that you would calculate the embeddings of code chunks, and the embedding of the prompt, and take those chunks that are most similar to the embedding of the prompt as context. Edit: This, btw, is also the reason why I think that this here popped up on the hackernews frontpage a short while ago: https://github.com/pgvector/pgvector

This sounds like a reasonable start. Eventually we need to get to the point where we can expose an API for models to request additional information on their own.

Exactly, but this has some scary implications in the future - imagine when it is common pratice to allow AIs API access as a matter of course...

When giving a prompt, the prompt causes the crawling of many APIs to build the response - the power of such activity/features, will be scary power-to-authoratarian goals.

Imagine if the prompt is "Select all users who have political beliefs, posts, comments, links from APIs A, B, C, etc where sentiment appears to dissent from [party line]"

Re: Show HN: GPT Repo Loader – load entire code repos into GPT prompts

#142
post #39

Earlier quoted context omitted.

6c per thousand tokens, so $2 per maxed out API call

Still super expensive. You cant build a business arround it with these rates. It should be at least 1000 times cheaper if not more.

Stupid question: "How could all the crypto mining infra be reporpused to be GPU GPT prompting farms?"

Re: Show HN: GPT Repo Loader – load entire code repos into GPT prompts

#143
post #69

I’m thinking if GPT can write entire programs professionally and iterate, it would be OpenAI that benefit the most and would be a guarded asset I.e not open to public till it’s safe for release. Most of us probably don’t need to worry about work after that as that could well be AGI

OpenAI already has access to any prompts anybody uses to write programs using GPT. Who’s to say GPT-4 isn’t some ploy to gather data to train private AGI?

This is precisely what I believe is happening.

What other 'relationships' does OpenAI have with [corp/gov] where the private AGI is shared/sold/service as product to NGO or GOV customers?

Re: Show HN: GPT Repo Loader – load entire code repos into GPT prompts

#144
post #126

Earlier quoted context omitted.

I disagree that logic or math are the same as a programming language; a programming language is defined by the fact that a machine can execute it. Plus also most math and logic is still communicated and developed in a mix of human languages (English etc) and ad-hoc, not rigoursly defined notation; it's nowhere near the precision of a programming language. Though you CAN of course grind it out at that level, if you wa…

Well what you want is one and only one behavior. You're going to need to be specific to the point where what you're specifying is that singular behavior. An interesting example is a binary search, which is easy to informally specify, although it's shockingly difficult to produce a correct implementation. [1] Given what you want is a singular specific behavior, not just sorta that behavior, but exactly that behavior,…

You want one behavior from the perspective of the user's desire, but there will be a very large set of possible programs that will achieve that desire. So you just need to be precise w/r/t desire, not with the nitty gritty behavior. Traditional programming languages are great to expressing the nitty gritty behavior, and bad at capturing the desire.

Don't think of LLMs as akin to COBOL or Basic (or HyperTalk, is another great example) -- those are essentially rigid languages with a sprinkling of "Englishness" to try to make them seem less foreign to novice users. And yes, that just gets in the way once you become proficient in rigid languages.

But that's a completely different beast than programming in actual English.

So for example, the reason binary search (a simple algorithm) is hard to implement is because of the mismatch between easy to understand human desire and the pickiness of the rigid language designed for the machine.

Now, it is very easy to implement a correct binary search.

Tell ChatGPT:

> Write a binary search method in C#

It responds:

    public static int Search(int[] arr, int target)
    {
        int left = 0;
        int right = arr.Length - 1;

        while (left 
We can also ask it:

> Prove it is correct

It responds:

> To prove the correctness of the binary search algorithm, we can use a technique called loop invariant. A loop invariant is a condition that remains true for every iteration of the loop. In this case, the loop invariant is that the target element, if it exists in the array, will always be within the range defined by the left and right pointers.

> Loop Invariant: At the start of every iteration, if the target element exists in the array, it must be within the subarray arr[left, right].

> Initialization: At the beginning, left = 0 and right = arr.Length - 1, which covers the entire array. So, if the target element is present in the array, it must be within the initial range.

> Maintenance: During each iteration, the algorithm examines the middle element (mid = left + (right - left) / 2). There are three cases:

> If arr[mid] == target, the target element is found and returned. > If arr[mid] If arr[mid] > target, the target must be in the left half of the subarray. Therefore, we update right = mid - 1. Since the array is sorted, we are sure the target is in the range arr[left, mid - 1] if it exists in the array. > In cases 2 and 3, we have updated either the left or right pointer, maintaining the loop invariant for the next iteration.

> Termination: The loop terminates when left > right. Due to the loop invariant, if the target element exists in the array, it must be in the range arr[left, right]. Since left > right, this range is now empty, which means the target element is not in the array, so the algorithm returns -1.

> In conclusion, the binary search algorithm is correct, as it either returns the index of the target element if it exists in the sorted array, or -1 if it doesn't.

(OK, I'd quibble with that proof a little bit -- it was a little hand-wavy on why the loop must terminate.)

How about the broken binary search you linked to?

Ask ChatGPT:

> Can you find the bug in this java binary search implementation? [Code]

It responds:

> The given binary search implementation appears to be correct, assuming that the input array a is sorted in ascending order. However, there is a potential issue with integer overflow when calculating the middle index mid. To avoid this, you can calculate mid using the following line:

    int mid = low + ((high - low) / 2);
So maybe now you can see how English might be a superior way to program.

Re: Show HN: GPT Repo Loader – load entire code repos into GPT prompts

#145
post #144

Earlier quoted context omitted.

Well what you want is one and only one behavior. You're going to need to be specific to the point where what you're specifying is that singular behavior. An interesting example is a binary search, which is easy to informally specify, although it's shockingly difficult to produce a correct implementation. [1] Given what you want is a singular specific behavior, not just sorta that behavior, but exactly that behavior,…

You want one behavior from the perspective of the user's desire, but there will be a very large set of possible programs that will achieve that desire. So you just need to be precise w/r/t desire, not with the nitty gritty behavior. Traditional programming languages are great to expressing the nitty gritty behavior, and bad at capturing the desire. Don't think of LLMs as akin to COBOL or Basic (or HyperTalk, is anoth…

Right, I brought it up as an instance of a class of problems that has this property of being easy to specify but difficult to implement correctly. It will know how to implement a binary search because a great deal of articles have been written about the correct way of implementing a binary search and the pitfalls of this one particular problem is very well documented.

It's almost unique in that the problem has a corpus of literature about how difficult they are to implement correctly, which pitfalls are common, and how to solve them. ChatGPT being able to regurgitate this solution is not a good demonstration of it's ability to solve general programming problems.

Re: Show HN: GPT Repo Loader – load entire code repos into GPT prompts

#146
post #49

Earlier quoted context omitted.

It's still probably extemely against any reasonable business's code of conduct.

Why would it be? Most businesses have no issue hosting private stuff on cloud or in github private repos. TOS and trust matter the most.

Because the business has those relationships worked out. I can't just decide that I trust OpenAI and send my company's code over, that would be insanity.

Re: Show HN: GPT Repo Loader – load entire code repos into GPT prompts

#147

Earlier quoted context omitted.

This sounds like a reasonable start. Eventually we need to get to the point where we can expose an API for models to request additional information on their own.

Exactly, but this has some scary implications in the future - imagine when it is common pratice to allow AIs API access as a matter of course... When giving a prompt, the prompt causes the crawling of many APIs to build the response - the power of such activity/features, will be scary power-to-authoratarian goals. Imagine if the prompt is "Select all users who have political beliefs, posts, comments, links from APIs…

Imagine that these prompts are not triggered by humans anymore, but by the AI invoking itself.

Sam Altman takes comfort in the thought that their AI does nothing without a human prompting it, so it has a human in the loop, as a circuit breaker if you will.

This assumption is rapidly becoming a mere hope, as right now probably hundreds of developers are working on systems which, when put into production and connected to other systems, might just come down to: the AI is calling itself, and giving itself orders.

Re: Show HN: GPT Repo Loader – load entire code repos into GPT prompts

#148
So I just tried it out. The output.txt which was generated was... 375mb of mostly binary junk. I'm a lazy lark and have lots of nonsense in this repo which I shouldn't, but I was hoping the tool might be able to detect which files are "meaningful" or not.

I tried again after updating the script to accept a .gptinclude file (this functionality was entirely added by one GPT-4 query). This time the output file was a much more acceptable 744kb.

Now upon hitting the actual API, I'm being informed that there's a token limit of 4096 (which I wasn't aware of and isn't mentioned in the repo).

Doesn't that really severely limit the usefulness? What good is it uploading a repo if you're only limited to 4096 words? That's scarcely a couple files!

Sort of wish I hadn't spent time on this - I feel like in theory it's a nice idea, but so limited in practice that I don't see it being useful for anyone working on something meaningful.

Re: Show HN: GPT Repo Loader – load entire code repos into GPT prompts

#149
post #144

Earlier quoted context omitted.

You want one behavior from the perspective of the user's desire, but there will be a very large set of possible programs that will achieve that desire. So you just need to be precise w/r/t desire, not with the nitty gritty behavior. Traditional programming languages are great to expressing the nitty gritty behavior, and bad at capturing the desire. Don't think of LLMs as akin to COBOL or Basic (or HyperTalk, is anoth…

Right, I brought it up as an instance of a class of problems that has this property of being easy to specify but difficult to implement correctly. It will know how to implement a binary search because a great deal of articles have been written about the correct way of implementing a binary search and the pitfalls of this one particular problem is very well documented. It's almost unique in that the problem has a corp…

That's my general point: it's easier to say what you want than to implement it in a low-level (relative to English) language. Hence why English is a good programming language.

And LLMs aren't just good at binary search, they're good at lots of things.

Imagine you are in a room with a programmer who is unquestionably better and more expert than you are.

Now let's say you need to write a program. Would you be better off trying to write it yourself, or describing what you want to the better programmer, and letting them write it?

Obviously the latter!

Given a sufficiently advanced compatriot, English is the preferred programming language.

Now, are LLMs good enough? Probably not yet, but getting there rapidly!

Re: Show HN: GPT Repo Loader – load entire code repos into GPT prompts

#150

Earlier quoted context omitted.

I think it will be a bit of both, why reach for that module when you can just get AI to write the 10% you need so quickly? (Which is actually a net gain I think in many cases, just look at leftpad drama) But the productivity boost from AI will also lead to more libraries available that do useful things in the areas it's not so sharp. They will also start to lean in to AI assisted coding styles too of course. And once…

I think the end of libraries would be bad, even for LLMs, they're not super intelligence and the more spaghetti code they're asked to work with, the less likely they will be able to perform, because statistically, they will be very hard to grok. It will increasingly have to deal with more and more entropy. Infact, it probably performs so well because of the heavy use of libraries we see today. Also side note: I doubt…

Ultimately if everyone stops writing libraries how will GPT get new data to train on? It will form some kind of feedback loop on its own outputs and just write shittier and shittier code.
Post reply on HN