langflow icon indicating copy to clipboard operation
langflow copied to clipboard

Documentation: Add simple "getting started" examples

Open clstaudt opened this issue 2 years ago • 10 comments
trafficstars

It would be great if the documentation included a few minimal working examples to get started with.

For example, it wasn't intuitive to me how to recreate something similar to the ChatGPT web interface.

Screenshot 2023-04-09 at 12 40 33

clstaudt avatar Apr 09 '23 10:04 clstaudt

You can use a ConversationChain, but you won't be able to customize the prompt or use tools it seems.

With LLMChain, I've almost managed to do a simple ChatGPT-style bot. You have to add a ConversationBufferMemory, and the following PromptTemplate:

The following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know.

Current conversation:

{history}
Human: {text}
AI:

This has a few flaws: you still cannot use tools, and does fairly often dream up the rest of the conversation:

but it might be a good starting point.

notpushkin avatar Apr 09 '23 14:04 notpushkin

@notpushkin Thanks for the hint. This seems to behave like ChatGPT:

Screenshot 2023-04-09 at 17 08 10

I think something like this should be included as a "Hello World" example in the documentation.

clstaudt avatar Apr 09 '23 15:04 clstaudt

This is definitely something we are lacking at the moment. We improved a lot of the code and added many simpler options to experiment with so now might be a good time for us to add these examples.

@notpushkin the ConversationChain is essentially a LLMChain with a preconfigured prompt. We are looking into improving the prompt experience(mainly by adding more control to input_variables and such).

In the case of the ConversationChain some improvements could be made. Keep an eye on #146.

ogabrielluiz avatar Apr 10 '23 15:04 ogabrielluiz

Tangential: I was able to get tools working if I drop conversation memory:

image

langflow-tools-without-memory.json

Bad news: when I add any kind of memory to the mix, I get the following error:

Error: One input key expected got ['input', 'agent_scratchpad']

My best guess is, memory.save_context gets both input and agent_scratchpad and doesn't know which one of these it should save as the user message. Is there a way to get it working? (perhaps this could be a good cue for me to start a separate issue haha)

notpushkin avatar Apr 11 '23 17:04 notpushkin

I hope that a template market can be realized, and everyone can contribute to the directory, just like the marketplaces of https://github.com/FlowiseAI/Flowise

ChasLui avatar Apr 23 '23 03:04 ChasLui

I think a simple method to add tutorials would just create an examples folder. Then export some working code.

frankjoshua avatar Apr 27 '23 03:04 frankjoshua

@frankjoshua I think that's what's going on in https://github.com/logspace-ai/langflow_examples? (e. g. see PR directly above your comment)

I think this examples repo needs some more visibility though.

notpushkin avatar Apr 27 '23 10:04 notpushkin

We plan on publishing something about them really soon. We are just working on the docs first.

ogabrielluiz avatar Apr 28 '23 13:04 ogabrielluiz

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jun 12 '23 13:06 stale[bot]

pew

notpushkin avatar Jun 12 '23 15:06 notpushkin