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

Part 3: Automated Testing for Prompts #5

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Part 3: Automated Testing for Prompts #5

wants to merge 2 commits into from

Conversation

imaustink
Copy link

@imaustink imaustink commented Apr 30, 2024

  • Link blog article once published.

test: ["CMD-SHELL", "curl --fail http://localhost:8233/ || exit 1"]
interval: 10s
timeout: 30s
retries: 3
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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 \
'
Copy link
Author

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"
Copy link
Author

Choose a reason for hiding this comment

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

Run testPromptsWorkflow.

@imaustink imaustink force-pushed the part-3 branch 2 times, most recently from 4ac86c2 to b469e4b Compare May 1, 2024 00:02
}
return _gptModel
}
const getGPTModel = createMemoizedOpenAI();
Copy link
Author

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') ],
Copy link
Author

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',
}
}
Copy link
Author

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>({
Copy link
Author

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]()
Copy link
Author

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' ],
Copy link
Contributor

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.' ],
Copy link
Contributor

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.

Copy link
Contributor

@phillipskevin phillipskevin left a 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.

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.

None yet

3 participants