Sleetza
Sleetza
BRBuildShip + Rowy
Created by Sleetza on 5/13/2024 in #❓・buildship-help
trouble exporting default function
So how can I figure out why it does only work isolated but not in the work flow?
24 replies
BRBuildShip + Rowy
Created by Sleetza on 5/13/2024 in #❓・buildship-help
trouble exporting default function
Right
24 replies
BRBuildShip + Rowy
Created by Sleetza on 5/13/2024 in #❓・buildship-help
trouble exporting default function
Its back, thanks. Any word yet on the input/output too large thing?
24 replies
BRBuildShip + Rowy
Created by Sleetza on 5/13/2024 in #❓・buildship-help
trouble exporting default function
No description
24 replies
BRBuildShip + Rowy
Created by Sleetza on 5/13/2024 in #❓・buildship-help
trouble exporting default function
Am I hitting memory limits?
24 replies
BRBuildShip + Rowy
Created by Sleetza on 5/13/2024 in #❓・buildship-help
trouble exporting default function
Any clue what might be causing this?
24 replies
BRBuildShip + Rowy
Created by Sleetza on 5/13/2024 in #❓・buildship-help
trouble exporting default function
No description
24 replies
BRBuildShip + Rowy
Created by Sleetza on 5/13/2024 in #❓・buildship-help
trouble exporting default function
You mean logging the 'text' and 'json' input variables when running the workflow?
24 replies
BRBuildShip + Rowy
Created by Sleetza on 5/13/2024 in #❓・buildship-help
trouble exporting default function
No description
24 replies
BRBuildShip + Rowy
Created by Sleetza on 5/13/2024 in #❓・buildship-help
trouble exporting default function
It should replace '#####' and does that when I test the node isolated.
24 replies
BRBuildShip + Rowy
Created by Sleetza on 5/13/2024 in #❓・buildship-help
trouble exporting default function
No description
24 replies
BRBuildShip + Rowy
Created by Sleetza on 5/13/2024 in #❓・buildship-help
trouble exporting default function
I am not getting an error
24 replies
BRBuildShip + Rowy
Created by Sleetza on 5/9/2024 in #❓・buildship-help
Buildship doubling quotation marks
Hey @Gaurav Chadha I figured it had to do with how I was copy pasting my data and not Buildship. It was Excel (since it was also happening when pasting to notepad). Without double clicking the cell containing my object it would double all quotation marks. When I would double click the cell first and then select all to copy it did not do that.
5 replies
BRBuildShip + Rowy
Created by Sleetza on 5/3/2024 in #❓・buildship-help
Node escaping backslashes
I altered the code to log the type of input2: // Node Logic export default async function enrichJSON(input1, input2, jsonString) { // Log the type of input2 console.log(Type of input2: ${typeof input2}); // Check if input2 is a string if (typeof input2!== 'string') { // Create a custom error message including the type of input2 const errorMessage = Error: input2 must be a string. Received type: ${typeof input2}; console.error(errorMessage); return errorMessage; } // Step 1: Convert input2 to an array of lines without line numbers const linesArray = input2.split('\n').map(line => line.replace(/^\sLINE\d{4}\s/, '')); // Step 2: Process the JSON object const jsonObject = JSON.parse(jsonString); jsonObject.werkervaring.forEach(workExperience => { const startLineIndex = linesArray.findIndex(line => line.startsWith(workExperience.omschrijvingStartLine)); const endLineIndex = linesArray.findIndex(line => line.startsWith(workExperience.omschrijvingEndLine)); if (startLineIndex!== -1 && endLineIndex!== -1) { const omschrijvingText = linesArray.slice(startLineIndex, endLineIndex + 1).join('\n'); workExperience.omschrijving = omschrijvingText; } }); // Step 3: Return the updated JSON object return JSON.stringify(jsonObject, null, 2); } It says the provided string is an object
14 replies
BRBuildShip + Rowy
Created by Sleetza on 5/3/2024 in #❓・buildship-help
Node escaping backslashes
It doesnt work in the full workflow either when selecting a variable that is an output string of an earlier node in the workflow.
14 replies
BRBuildShip + Rowy
Created by Sleetza on 5/3/2024 in #❓・buildship-help
Node escaping backslashes
I still get an error related to an input not being a string. In test mode I open the input2 expanded text area (set to text) and then paste in a string (result of another node). Then I run the node but it fails because input2 is not a string. Here is the node:
14 replies
BRBuildShip + Rowy
Created by Sleetza on 5/3/2024 in #❓・buildship-help
Node escaping backslashes
thx
14 replies
BRBuildShip + Rowy
Created by Sleetza on 5/3/2024 in #❓・buildship-help
Node escaping backslashes
If I paste a string that contains linebreaks into a text field of any node, and later copy that same text out of that text field, the line breaks are gone. I need them for processing.
14 replies
BRBuildShip + Rowy
Created by Sleetza on 5/3/2024 in #❓・buildship-help
Node escaping backslashes
import { RecursiveCharacterTextSplitter } from "langchain/text_splitter"; import axios from 'axios'; import pdf from '@cyber2024/pdf-parse-fixed'; export default async function pdfToTextAndChunk({ pdfUrl, chunkSize, chunkOverlap }) { // Step 1: Extract text from the PDF let dataBuffer; if (pdfUrl) { const response = await axios.get(pdfUrl, { responseType: 'arraybuffer' }); dataBuffer = response.data; } else { throw Error("You must specify a PDF URL."); } const data = await pdf(dataBuffer); const text = data.text; // Step 2: Chunk the extracted text const splitter = new RecursiveCharacterTextSplitter({ chunkSize, chunkOverlap, separators: ["\n\n", "\n", " ", ""], }); // Wrap the input text in backticks to handle it as a template literal const templateLiteralText = ${text}; // Pass the template literal text to createDocuments const output = await splitter.createDocuments([templateLiteralText]); // Extract the pageContent from each document to get the chunks const chunks = output.map(doc => doc.pageContent); return chunks; }
14 replies