-
Notifications
You must be signed in to change notification settings - Fork 0
Demos 1197 UI path lambda #548
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
base: main
Are you sure you want to change the base?
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
This is untested, but it does run locally with npm run execute
added the ui path constructor
removed secrets from env added to secret manager Basically pulled out any wierd stuff
Really i had gotten all the URLs confused not thinking there was two of then, so this is a clean up of that.
And make logs easier to read locally
I think this is done for now, but UI path not cooperating
james-becwar-cms
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets get this running on an ephemeral env before merge. Regarding the db and s3 stuff not sure if you wanted to do it now, or in a new ticket.
|
|
||
| ## Lambda usage | ||
| - Handler: `index.handler` | ||
| - Trigger: SQS message body must contain `{ "s3Key": "<path/to/file>" }` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the S3key will be make future quarries kind of weird, you would have to search the db's document table where the path is equal to the path in the sqs message. I would pass the PK, the document id. Once we have the questions and models, we will have to pull the file type, and application id, questions for that file type, and fields to update from the db.
| } | ||
|
|
||
| export async function extractDoc(token: string, docId: string): Promise<string> { | ||
| const extractorGuid = getExtractorGuid(); // NOTE: Zoe might make her own. So we may need to query here to get the right GUID |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good idea. I think its going to be a different model based on the file type.
| const activeQuestionBlobs: ExtractionPrompt[] = [ | ||
| { | ||
| id: "State", | ||
| question: "What state is this 1115 waver for?", | ||
| fieldType: "Text", | ||
| multiValued: false, | ||
| }, | ||
| ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the future these will need to be pulled from the db based on file type.
| const url = `${UIPATH_BASE_URL}/${UIPATH_TENANT}/du_/api/framework/projects/${projectId}/digitization/start`; | ||
| log.info({ url }, "Uploading document to UiPath"); | ||
| const formData = new FormData(); | ||
| formData.append("file", fs.createReadStream(fileName), fileName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file won't be local on the lambda, so I don't think this will work.
| throw new Error("Missing s3Key in SQS message body."); | ||
| } | ||
|
|
||
| const status = await runDocumentUnderstanding(inputFile, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be smart to pull the file from S3 before we started the DU stuff.
| const { | ||
| token: providedToken, | ||
| pollIntervalMs = 3000, | ||
| maxAttempts = 500, // Just to put SOME kinda limit on it. DO not want it just running FOREVER! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can remove this as AWS will kill the lambda at 15 minutes. (500 tries at 3 seconds > 15 minutes)
Something with the packages is not working.
npm run synth errors
Added suppression for now
Not merging anyway yet.
|
Made this a draft for the moment, want to get this on ephemeral. |
(it was called lambda before lol)
|
I made this ready for review. but really i just want to the pipes to run when i push. |
I'm not gonna merge this yet, needs testing on ephemeral first.
Just wrapping up the unit tests... SO still kinda WIP but almost there.
Got a localstack UI Path Lambda working.
This takes a base64 encoded file and uses generative AI to abstract values