gpt-engineer icon indicating copy to clipboard operation
gpt-engineer copied to clipboard

Langchain integration

Open hrobbins opened this issue 2 years ago • 8 comments

Trying to keep things simple for this initial conversion to LangChain. The only difference with the original functionality is this version doesn't stream the output from OpenAI, so there is bit of a delay in waiting for the result.

This branch will enable using any LLM, from hugging-face, locally, any LangChain supported LLM service, such as Anthropic/Claude, or pointing it to a Custom LLM.

hrobbins avatar Jul 02 '23 02:07 hrobbins

Thanks @hrobbins for contributing to improving the repository!

I can see the case for being able to use other language models, but I think we can do that without langchain, and we want to keep it simple. Are there other advantages?

We only merge PRs that use python pep8, doesn't leave comments hanging around etc. So since this is not the focus right now, I will close the PR, but feel free to open it if you are committed to fixing everything and can argue for why we want langchain today.

AntonOsika avatar Jul 02 '23 12:07 AntonOsika

There is a lot of good stuff here so happy to reopen

AntonOsika avatar Jul 02 '23 14:07 AntonOsika

@hrobbins thought more about it and I like many things here

would need to address the comments and make sure streaming is still working before we merge though.

Have you given up on this or are you up for the challenge?

AntonOsika avatar Jul 06 '23 21:07 AntonOsika

@hrobbins if you don't have the time to do it, let me know - id be happy to do it!

need this to finish https://github.com/AntonOsika/gpt-engineer/pull/431

(cc @AntonOsika)

UmerHA avatar Jul 07 '23 11:07 UmerHA

Can probably polish it up today. Already made most of the recommended changes, looks like it just needs a callback handler for the streaming.

For other reasons, I started working on breaking down the processes into more isolated requests to the LLM so each one is individually a smaller response anyway. Streaming is less important when we're not asking it to do everything at once with each call. But I can go ahead and re-add it.

-H

On Fri, Jul 7, 2023, 4:31 AM UmerHA @.***> wrote:

@hrobbins https://github.com/hrobbins if you don't have the time to do it, let me know - id be happy to do it!

need this to finish #431 https://github.com/AntonOsika/gpt-engineer/pull/431

(cc @AntonOsika https://github.com/AntonOsika)

— Reply to this email directly, view it on GitHub https://github.com/AntonOsika/gpt-engineer/pull/466#issuecomment-1625276107, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGVMKNSEEQ2IT3WWP5KUDDXO7XSFANCNFSM6AAAAAAZ3E6INA . You are receiving this because you were mentioned.Message ID: @.***>

hrobbins avatar Jul 07 '23 13:07 hrobbins

Hey @hrobbins! Sorry, I was too eager 🙈 I had already implemented it before I saw your response.

Here's the branch: https://github.com/UmerHA/gpt-engineer/commits/langchain-integration.

Iiuc, the scope of this PR is to make it work for (i) LangChain models, (ii) HuggingFace models, and (iii) local models. I've done (i), so you could still do (ii) and (iii).

If you want, I can merge my code into yours? Or should I open a PR instead?

Will do what you decide.

UmerHA avatar Jul 07 '23 14:07 UmerHA

No worries, go for it.

-H

On Fri, Jul 7, 2023, 7:38 AM UmerHA @.***> wrote:

Hey @hrobbins https://github.com/hrobbins! Sorry, I was too eager 🙈 I had already implemented it before I saw your response.

Here's the branch: https://github.com/UmerHA/gpt-engineer/commits/langchain-integration.

Iiuc, the scope of this PR is to make it work for (i) LangChain models, (ii) HuggingFace models, and (iii) local models. I've done (i), so you could still do (ii) and (iii).

If you want, I can merge my code into yours? Or should I open a PR instead?

Will do what you decide.

— Reply to this email directly, view it on GitHub https://github.com/AntonOsika/gpt-engineer/pull/466#issuecomment-1625513391, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGVMKN5P6IPHSDFQNPNJKDXPANPZANCNFSM6AAAAAAZ3E6INA . You are receiving this because you were mentioned.Message ID: @.***>

hrobbins avatar Jul 07 '23 16:07 hrobbins

Hey @hrobbins! Sorry, I was too eager 🙈 I had already implemented it before I saw your response.

Here's the branch: https://github.com/UmerHA/gpt-engineer/commits/langchain-integration.

Iiuc, the scope of this PR is to make it work for (i) LangChain models, (ii) HuggingFace models, and (iii) local models. I've done (i), so you could still do (ii) and (iii).

If you want, I can merge my code into yours? Or should I open a PR instead?

Will do what you decide.

Reviewed what you did. Nicely done!

hrobbins avatar Jul 07 '23 18:07 hrobbins