-
Notifications
You must be signed in to change notification settings - Fork 0
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
Part 3: Automated Testing for Prompts #5
base: main
Are you sure you want to change the base?
Conversation
imaustink
commented
Apr 30, 2024
•
edited by marshallswain
edited by marshallswain
- Link blog article once published.
test: ["CMD-SHELL", "curl --fail http://localhost:8233/ || exit 1"] | ||
interval: 10s | ||
timeout: 30s | ||
retries: 3 |
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.
Add health check to ensure Temporal is running.
localstack: | ||
condition: service_healthy | ||
postgres: | ||
condition: service_started |
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.
Wait for Temporal to be healthy.
localstack: | ||
condition: service_healthy | ||
postgres: | ||
condition: service_started |
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.
Wait for Temporal to be healthy.
sh -c '\ | ||
sleep 10 \ | ||
&& npx nodemon --watch src --ext ts src/test-prompts-worker.ts \ | ||
' |
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.
Added worker for testPromptsWorkflow
.
@@ -6,7 +6,8 @@ | |||
"build": "tsc --build", | |||
"start": "ts-node src/process-documents-worker.ts && ts-node src/invoke-prompt-worker.ts", | |||
"process-documents": "ts-node src/process-documents-client.ts", | |||
"invoke-prompt": "ts-node src/invoke-prompt-client.ts" | |||
"invoke-prompt": "ts-node src/invoke-prompt-client.ts", | |||
"test-prompts": "ts-node src/test-prompts-client.ts" |
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.
Run testPromptsWorkflow
.
4ac86c2
to
b469e4b
Compare
} | ||
return _gptModel | ||
} | ||
const getGPTModel = createMemoizedOpenAI(); |
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.
Moved to central location for sharing.
[ 'system', 'Whenever possible, use code examples derived from the documentation provided.' ], | ||
[ 'system', 'Import references must be included where relevant so that the reader can easily figure out how to import the necessary dependencies.' ], | ||
[ 'system', 'Do not use your existing knowledge to determine import references, only use import references as they appear in the relevant documentation for Hatchify' ], | ||
[ 'system', `Here is the Hatchify documentation that is relevant to the user's query:` + relevantDocumentation.join('\n\n') ], |
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.
Updated prompt to improve quality of results.
contentColumnName: 'content', | ||
metadataColumnName: 'metadata', | ||
} | ||
} |
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.
We close the connection after each execution so memoization leads to an error on the second execution.
|
||
const { createS3Bucket, deleteS3Object, deleteS3Bucket } = proxyActivities<typeof activities>({ | ||
const { createS3Bucket, deleteS3Object, deleteS3Bucket, generatePrompt, invokePrompt, loadTestCases } = proxyActivities<typeof activities>({ |
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.
Consolidated "1 minute" activities.
|
||
- [Your Next AI Startup Should Be Built on Temporal - Part 1](https://www.bitovi.com/blog/your-next-ai-startup-should-be-built-on-temporal-part-1-document-processing) | ||
- [Your Next AI Startup Should Be Built on Temporal - Part 2](https://www.bitovi.com/blog/your-next-ai-startup-should-be-built-on-temporal-part-2-prompt-engineering) | ||
- [Your Next AI Startup Should Be Built on Temporal - Part 3]() |
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.
TODO: Update the href to point to the published article
[ 'system', 'You should respond in short paragraphs, using Markdown formatting, separated with two newlines to keep your responses easily readable.' ], | ||
[ 'system', 'Whenever possible, use code examples derived from the documentation provided.' ], | ||
[ 'system', 'Import references must be included where relevant so that the reader can easily figure out how to import the necessary dependencies.' ], | ||
[ 'system', 'Do not use your existing knowledge to determine import references, only use import references as they appear in the relevant documentation for Hatchify' ], |
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.
😂
const gptModel = getGPTModel() | ||
|
||
const response = await gptModel.invoke([ | ||
[ 'system', 'You are responsible for verifying that prompt provided invoked the correct response from an LLM. Consider the following question and expected answer as well as the prompt\'s answered.' ], |
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.
should prompt's answered
be prompt's answer
? It likely doesn't make a difference, just curious.
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 looks good! Thank you for the detailed comments on the PR. I just left one comment on a possible typo. Good to merge either way.