Last active
August 9, 2025 17:13
-
-
Save dfinke/6c57db3127ffdfe60ff723290710d595 to your computer and use it in GitHub Desktop.
A PowerShell function that uses GPT to parse questions like 'a week ago' or 'in July' into precise YYYY-MM-DD formats.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Requires -Module PSAISuite | |
function Find-Date { | |
param( | |
[string]$question, | |
[string]$model = 'github:openai/gpt-4.1' | |
) | |
$instructions = @" | |
Current Date: $(Get-Date -Format "yyyy-MM-dd") | |
## Clarifying End Dates: | |
Relative references ("a week ago", "one month ago"): Use the current conversation start date as the end date. | |
Absolute references ("in July", "between 12-05 to 12-08"): Use explicitly implied end dates. | |
Output just the dates in the format YYYY-MM-DD. If no dates are found, respond with "No dates found". | |
Question: $question | |
"@ | |
Invoke-ChatCompletion -Model $model $instructions | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This requires the PSAISuite module
📦Install-Module PSAISuite
🔗https://github.com/dfinke/psaisuite
https://x.com/dfinke