Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: new AI tutorial #2799

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft

WIP: new AI tutorial #2799

wants to merge 10 commits into from

Conversation

evilnick
Copy link
Contributor

This just sketches out the steps at the moment, posted for initial feedback on structure and elements.

Copy link

netlify bot commented Jan 30, 2025

Deploy Preview for n8n-docs ready!

Name Link
🔨 Latest commit 45686bb
🔍 Latest deploy log https://app.netlify.com/sites/n8n-docs/deploys/67a0bb1ee092970008c4274f
😎 Deploy Preview https://deploy-preview-2799--n8n-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

github-actions bot commented Jan 30, 2025

Overall readability score: 44.87 (🔴 -0.03)

File Readability
intro-tutorial.md 66.57 (🔴 -9.36)
View detailed metrics

🟢 - Shows an increase in readability
🔴 - Shows a decrease in readability

File Readability FRE GF ARI CLI DCRS
intro-tutorial.md 66.57 55.54 9.45 10.6 10.32 7.2
  🔴 -9.36 🔴 -3.15 🔴 -2.12 🔴 -1.5 🔴 -0.53 🔴 -0.71

Averages:

  Readability FRE GF ARI CLI DCRS
Average 44.87 35.73 11.37 14.57 14.19 8.42
  🔴 -0.03 🔴 -0.01 🟢 +0 🔴 -0.01 🟢 +0 🟢 +0
View metric targets
Metric Range Ideal score
Flesch Reading Ease 100 (very easy read) to 0 (extremely difficult read) 60
Gunning Fog 6 (very easy read) to 17 (extremely difficult read) 8 or less
Auto. Read. Index 6 (very easy read) to 14 (extremely difficult read) 8 or less
Coleman Liau Index 6 (very easy read) to 17 (extremely difficult read) 8 or less
Dale-Chall Readability 4.9 (very easy read) to 9.9 (extremely difficult read) 6.9 or less

@evilnick evilnick requested a review from imchairmanm January 30, 2025 12:24
background-color: rgb(43, 155, 70);
-webkit-mask-image: var(--md-admonition-icon--info);
mask-image: var(--md-admonition-icon--info);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This adds a further style for an 'info' themed expandable section, similar to the existing 'details' one. The styling is taken from the default for material, but we can debate appropriate colours etc.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. Yeah, I think changes to the styling are fine. I think if we're going with green, it'd be good to try to riff off of the green we already use for the theme. That being said, with the website style changes coming, it might not matter all too much.

@evilnick
Copy link
Contributor Author


1. Close the node details view (Select **Back to canvas**) to return to the canvas.

??? explanation "Explanation..."
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The titles of these explanations will be edited to reflect the contents

??? explanation "Explanation..."
The trigger node generates output when there is an event causing it to trigger. In this case we want to be able to type in text to cause the workflow to run. In production, this trigger can be hooked up to a public chat interface as provided by n8n or embedded into another website. To start this simple workflow we will just use the built-in local chat interface to communicate, so no further setup is required.

<n8n-demo workflow="%7B%0A%20%20%22name%22%3A%20%22AI%20tutorial%22%2C%0A%20%20%22nodes%22%3A%20%5B%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22parameters%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22options%22%3A%20%7B%7D%0A%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%22type%22%3A%20%22%40n8n%2Fn8n-nodes-langchain.chatTrigger%22%2C%0A%20%20%20%20%20%20%22typeVersion%22%3A%201.1%2C%0A%20%20%20%20%20%20%22position%22%3A%20%5B%0A%20%20%20%20%20%20%20%20-200%2C%0A%20%20%20%20%20%20%20%20-40%0A%20%20%20%20%20%20%5D%2C%0A%20%20%20%20%20%20%22id%22%3A%20%22a2d42e1f-36df-4a6a-a3b4-99a162074d11%22%2C%0A%20%20%20%20%20%20%22name%22%3A%20%22When%20chat%20message%20received%22%2C%0A%20%20%20%20%20%20%22webhookId%22%3A%20%2297c1a41f-8ef0-4d63-a924-92eb634384d3%22%0A%20%20%20%20%7D%0A%20%20%5D%2C%0A%20%20%22pinData%22%3A%20%7B%7D%2C%0A%20%20%22connections%22%3A%20%7B%7D%2C%0A%20%20%22active%22%3A%20false%2C%0A%20%20%22settings%22%3A%20%7B%0A%20%20%20%20%22executionOrder%22%3A%20%22v1%22%0A%20%20%7D%2C%0A%20%20%22versionId%22%3A%20%22b1641385-c6b0-48a8-8e26-20d1f6bd7fda%22%2C%0A%20%20%22meta%22%3A%20%7B%0A%20%20%20%20%22instanceId%22%3A%20%22cb484ba7b742928a2048bf8829668bed5b5ad9787579adea888f05980292a4a7%22%0A%20%20%7D%2C%0A%20%20%22id%22%3A%20%22l05TkWXXYbOiuL4o%22%2C%0A%20%20%22tags%22%3A%20%5B%5D%0A%7D"></n8n-demo>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seemed more useful to establish a pattern of using our embedded workflow styles for these. I have a slight niggle with scrolling (if you are scrolling the text and you happen to land on one of these, you proceed to scroll the workflow rather than the text) and maybe these ones are simple enough that screenshots would be fine?
The main advantage here I see is that automating the generation of these parts could be fairly trivial and not involve filling up the repo with more images

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you're right about using the workflow component to render these. That might not have been an option when this was initially written.

I might not have understood your explanation above fully, but is there a reason you decided to define these in this way? Here, you're referencing the n8n-demo component directly, percent encoding the workflow, and define it inline. The way we typically do this is to put the workflow file in the docs/_workflows directory and then use the workflowDemo function to reference it like this. Are there advantages to doing it the way you do here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, no particular reason. I didn't find any appropriate examples. I guess the only advantage of embedding everything is that it makes it easier to test ( a subject for another day), but I will redo these for now then and maybe update the wiki to include it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm... is the standard here that it opens the code in a new tab? I think I prefer the forum style where it reveals the code block under the diagram and has a neat copy button. Out of scope for this work but maybe we should discuss that

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can find the function details here. Currently, for local files, it does just show the file, but there's no reason we can't adjust. Not sure if you saw this already, but these are the specific docs for the demo component that this uses.


TODO: summary of what was achieved

<n8n-demo workflow="%7B%0A%20%20%22name%22%3A%20%22AI%20tutorial%22%2C%0A%20%20%22nodes%22%3A%20%5B%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22parameters%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22options%22%3A%20%7B%7D%0A%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%22type%22%3A%20%22%40n8n%2Fn8n-nodes-langchain.chatTrigger%22%2C%0A%20%20%20%20%20%20%22typeVersion%22%3A%201.1%2C%0A%20%20%20%20%20%20%22position%22%3A%20%5B%0A%20%20%20%20%20%20%20%20-300%2C%0A%20%20%20%20%20%20%20%20-40%0A%20%20%20%20%20%20%5D%2C%0A%20%20%20%20%20%20%22id%22%3A%20%22a2d42e1f-36df-4a6a-a3b4-99a162074d11%22%2C%0A%20%20%20%20%20%20%22name%22%3A%20%22When%20chat%20message%20received%22%2C%0A%20%20%20%20%20%20%22webhookId%22%3A%20%2297c1a41f-8ef0-4d63-a924-92eb634384d3%22%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22parameters%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22options%22%3A%20%7B%7D%0A%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%22type%22%3A%20%22%40n8n%2Fn8n-nodes-langchain.agent%22%2C%0A%20%20%20%20%20%20%22typeVersion%22%3A%201.7%2C%0A%20%20%20%20%20%20%22position%22%3A%20%5B%0A%20%20%20%20%20%20%20%20-80%2C%0A%20%20%20%20%20%20%20%20-40%0A%20%20%20%20%20%20%5D%2C%0A%20%20%20%20%20%20%22id%22%3A%20%220f61a10f-668f-42f7-b835-cf3efb60082a%22%2C%0A%20%20%20%20%20%20%22name%22%3A%20%22AI%20Agent%22%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22parameters%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22model%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%22__rl%22%3A%20true%2C%0A%20%20%20%20%20%20%20%20%20%20%22mode%22%3A%20%22list%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22value%22%3A%20%22gpt-4o-mini%22%0A%20%20%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%20%20%22options%22%3A%20%7B%7D%0A%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%22type%22%3A%20%22%40n8n%2Fn8n-nodes-langchain.lmChatOpenAi%22%2C%0A%20%20%20%20%20%20%22typeVersion%22%3A%201.2%2C%0A%20%20%20%20%20%20%22position%22%3A%20%5B%0A%20%20%20%20%20%20%20%20-100%2C%0A%20%20%20%20%20%20%20%20160%0A%20%20%20%20%20%20%5D%2C%0A%20%20%20%20%20%20%22id%22%3A%20%22b8129c6d-f201-4378-8f66-ce9a6cfd5f3b%22%2C%0A%20%20%20%20%20%20%22name%22%3A%20%22OpenAI%20Chat%20Model%22%2C%0A%20%20%20%20%20%20%22credentials%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22openAiApi%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%22id%22%3A%20%22jiPPcYV9I70iKapN%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22name%22%3A%20%22OpenAi%20account%2037%22%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22parameters%22%3A%20%7B%7D%2C%0A%20%20%20%20%20%20%22type%22%3A%20%22%40n8n%2Fn8n-nodes-langchain.memoryBufferWindow%22%2C%0A%20%20%20%20%20%20%22typeVersion%22%3A%201.3%2C%0A%20%20%20%20%20%20%22position%22%3A%20%5B%0A%20%20%20%20%20%20%20%2020%2C%0A%20%20%20%20%20%20%20%20180%0A%20%20%20%20%20%20%5D%2C%0A%20%20%20%20%20%20%22id%22%3A%20%22afbab05c-1e87-4f7a-9d66-c86f9db1ec64%22%2C%0A%20%20%20%20%20%20%22name%22%3A%20%22Window%20Buffer%20Memory%22%0A%20%20%20%20%7D%0A%20%20%5D%2C%0A%20%20%22pinData%22%3A%20%7B%7D%2C%0A%20%20%22connections%22%3A%20%7B%0A%20%20%20%20%22When%20chat%20message%20received%22%3A%20%7B%0A%20%20%20%20%20%20%22main%22%3A%20%5B%0A%20%20%20%20%20%20%20%20%5B%0A%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%22node%22%3A%20%22AI%20Agent%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22type%22%3A%20%22main%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22index%22%3A%200%0A%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20%20%20%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%22OpenAI%20Chat%20Model%22%3A%20%7B%0A%20%20%20%20%20%20%22ai_languageModel%22%3A%20%5B%0A%20%20%20%20%20%20%20%20%5B%0A%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%22node%22%3A%20%22AI%20Agent%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22type%22%3A%20%22ai_languageModel%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22index%22%3A%200%0A%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20%20%20%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%22Window%20Buffer%20Memory%22%3A%20%7B%0A%20%20%20%20%20%20%22ai_memory%22%3A%20%5B%0A%20%20%20%20%20%20%20%20%5B%0A%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%22node%22%3A%20%22AI%20Agent%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22type%22%3A%20%22ai_memory%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22index%22%3A%200%0A%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20%20%20%5D%0A%20%20%20%20%7D%0A%20%20%7D%2C%0A%20%20%22active%22%3A%20false%2C%0A%20%20%22settings%22%3A%20%7B%0A%20%20%20%20%22executionOrder%22%3A%20%22v1%22%0A%20%20%7D%2C%0A%20%20%22versionId%22%3A%20%22b1641385-c6b0-48a8-8e26-20d1f6bd7fda%22%2C%0A%20%20%22meta%22%3A%20%7B%0A%20%20%20%20%22templateCredsSetupCompleted%22%3A%20true%2C%0A%20%20%20%20%22instanceId%22%3A%20%22cb484ba7b742928a2048bf8829668bed5b5ad9787579adea888f05980292a4a7%22%0A%20%20%7D%2C%0A%20%20%22id%22%3A%20%22l05TkWXXYbOiuL4o%22%2C%0A%20%20%22tags%22%3A%20%5B%5D%0A%7D" frame="true">
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This workflow uses the frame so it can be easily copied (if someone made a mistake or couldn't get those theirs to work. Could this work as a template instead?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By "as a template" do you mean published here or something else?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how the distinction works, but when using a template, rather than importing, you get a splash screen indicating what things you need to add (credentials), which I think would be better for this usage

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, yeah. For templates published in that library, we have a separate function that renders those, which is a step up from what you can do with a raw template.


## Next steps

* Explore n8n using the [Quickstarts](/try-it-out/).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when we have extra tutorials to build on this we would link them here


## 9. saving the workflow

## Congratulations!
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's always good to remind people of what they did, it's a reinforced learning thing that really works!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's definitely a good touch for tutorials. Good call out.

This tutorial requires n8n version 1.21.0 or above.
///
- n8n. For this tutorial we recommend using the [n8n cloud](/choose-n8n/cloud/) service - there is a free trial for new users!. For a self hosted service, refer to the [installation pages](/hosting/installation/docker/).
- Credentials for a chat model. This tutorial will use OpenAI, but you can easily user DeepSeek, Google Gemini, Groq, Azure and others (see the [sub-nodes documentation](/integrations/builtin/cluster-nodes/sub-nodes/) for more).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing I wonder about with this framing is whether we're introducing branching complexity here where we might prefer a beginner tutorial to be more streamlined and predictable. Maybe we could say something like "we're using OpenAI with this tutorial. Once you have it working, it's easy to swap out the model for your preferred choice" or something. Maybe it doesn't materially impact things though if the services are all equally reliable. I don't have strong feelings, but wanted to mention it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's a good point. I just wanted to highlight that people could pretty much use whatever they chose and namecheck a few things (e.g. DeepSeek probably helps SEO atm). I'll have a think

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants