Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fine Tuning LLM workshop

This notebook teaches the basics of fine tuning and has APIs for teams to compete.

We are hosting a 2 hour LLMs in production workshop December 10

In this workshop we will be teaching how to host and fine tune LLMs for production use cases.

We are also giving closed access to our proprietary cloud infrastructure with n8n integration.

Students get 60% off!

At checkout, use code:

STUDENT60

for discount

n8n custom nodes

Here are the custom nodes to use the custom model in n8n

Create request body node:

{ "nodes": [ { "parameters": { "jsCode": "// Build Request Body - Handles Simplified Load Output\nconst item = $input.first(); // Single merged item from Merge\n\nconst history = item.json.messages || []; // Your load output\nconst chatInput = item.json.chatInput || ''; // From trigger\nconst chatId = item.json.chatId;\n\n// Build alternating messages array\nconst messages = [];\n\nmessages.push({\n role: "system",\n content: "You are designed to analyze pharmaceutical documents and provide FDA type feedback to make their submission more robust and reduce bounce backs. Here's a guidance template for all submissions: "\n})\n\nfor (let i = 0; i < history.length; i++) {\n const msg = history[i];\n \n // Add user message (human)\n if (msg.human) {\n messages.push({\n role: "user",\n content: msg.human.trim() // Trim to clean up\n });\n }\n \n // Add assistant message (system)\n if (msg.system) {\n messages.push({\n role: "assistant",\n content: msg.system.trim()\n });\n }\n}\n\n// Add current user input ONLY if the last message in history is not the current one\n// (prevents duplicates if Save User Message ran before Load)\nconst lastHuman = history[history.length - 1]?.human || '';\nif (chatInput && chatInput.trim() !== lastHuman.trim()) {\n messages.push({\n role: "user",\n content: chatInput.trim()\n });\n}\n\nreturn [{\n json: {\n model_name: "/Volumes/Extreme Pro/models/gpt-oss-120b-4bit",\n company_name: "RecursionAI",\n company_id: "56a717db-2825-4cda-a09c-c1bae1948e09",\n messages: messages,\n temperature: 0.8\n }\n}];" }, "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 96, 16 ], "id": "bcb72085-43ef-430c-b3e2-25110fbf557f", "name": "Build Request Body" } ], "connections": { "Build Request Body": { "main": [ [] ] } }, "pinData": {}, "meta": { "templateCredsSetupCompleted": true, "instanceId": "b4ffaf957bd58cab5cefedf170eacac6933d340aad02b9480ed0afa44c33e84b" } }

Chat node

{ "nodes": [ { "parameters": { "method": "POST", "url": "https://uce.ngrok.app/inference/", "sendHeaders": true, "headerParameters": { "parameters": [ { "name": "Content-Type", "value": "application/json" } ] }, "sendBody": true, "bodyParameters": { "parameters": [ { "name": "model_name", "value": "={{ $json.model_name }}" }, { "name": "company_name", "value": "={{ $json.company_name }}" }, { "name": "company_id", "value": "={{ $json.company_id }}" }, { "name": "messages", "value": "={{ $json.messages }}" }, { "name": "temperature", "value": "={{ $json.temperature }}" } ] }, "options": {} }, "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.3, "position": [ 736, 144 ], "id": "db308046-eec7-4faf-82d1-5ac12f3fab14", "name": "RecursionAI_UCE" } ], "connections": { "RecursionAI_UCE": { "main": [ [] ] } }, "pinData": {}, "meta": { "templateCredsSetupCompleted": true, "instanceId": "b4ffaf957bd58cab5cefedf170eacac6933d340aad02b9480ed0afa44c33e84b" } }

Parse response node

{ "nodes": [ { "parameters": { "jsCode": "// Code Node: Parse Final Message\nconst output = [];\n\nfor (const item of $input.all()) {\n const content = item.json.content || '';\n const finalPart = content.split('&lt;|channel|&gt;final&lt;|message|&gt;')[1] || '';\n const cleanText = finalPart.split('&lt;|end|&gt;')[0].split('&lt;|start|&gt;')[0].trim();\n\n output.push({\n json: {\n response: cleanText,\n chatId: $('When chat message received').first().json.sessionId \n }\n });\n}\n\nreturn output;" }, "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 912, 144 ], "id": "3bfb0676-a63d-4677-ba1a-aaa55113178c", "name": "Parse Final Message" } ], "connections": { "Parse Final Message": { "main": [ [] ] } }, "pinData": {}, "meta": { "templateCredsSetupCompleted": true, "instanceId": "b4ffaf957bd58cab5cefedf170eacac6933d340aad02b9480ed0afa44c33e84b" } }

About

Crash course at the U

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages