Last active
September 28, 2025 22:03
-
-
Save dfinke/951f9588f225d0f7bb1558ed9248ff67 to your computer and use it in GitHub Desktop.
One-Shot JIRA Ticket Generator with PowerShell and PSAISuite
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 | |
$feature = 'Implement a GO program to chat with OpenAI models' | |
$prompt = @' | |
Based on this engineering spec for `{0}`, write a JIRA ticket that includes: | |
- problem statement | |
- context | |
- goals | |
- acceptance criteria | |
- technical notes for implementation. | |
'@ -f $feature | |
Write-Host "AI is generating a JIRA ticket for feature: $feature" -ForegroundColor Cyan | |
$response = Invoke-ChatCompletion -Model openrouter:x-ai/grok-4-fast:free -Message $prompt | |
$response > jira-ticket.md | |
Write-Host "JIRA ticket saved to jira-ticket.md`n" -ForegroundColor Green | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
JIRA Ticket
Summary: Implement a Go Program to Chat with OpenAI Models
Issue Type: Story
Priority: Medium
Assignee: [Unassigned]
Reporter: [Your Name]
Project: [Relevant Project, e.g., AI Integration]
Components: Go Development, AI/ML Integration
Labels: go-lang, openai, chat-interface
Description
Problem Statement
Currently, there is no dedicated Go-based command-line tool or program available in our codebase to interact with OpenAI's chat completion models (e.g., GPT-3.5 or GPT-4). Teams needing to prototype, test, or integrate OpenAI functionalities must rely on manual API calls via tools like curl or use language-specific SDKs in other languages (e.g., Python), which introduces context-switching and inefficiency for Go-centric projects.
Context
This implementation stems from an engineering specification to build a lightweight, reusable Go program for chatting with OpenAI models. It is intended as a foundational tool for internal developers to experiment with AI-driven features, such as natural language processing or automated responses in our applications. The program should support basic conversational interactions via the OpenAI Chat Completions API, allowing for easy extension into larger systems (e.g., integrating with web services or bots). This aligns with our broader goal of enhancing AI capabilities in Go-based microservices without depending on external wrappers.
Key assumptions:
https://api.openai.com/v1/chat/completions
).Goals
Acceptance Criteria
go build
without external dependencies beyond the standard library and a chosen OpenAI Go client library (e.g.,github.com/sashabaranov/go-openai
).OPENAI_API_KEY
); it fails gracefully with a clear error message if the key is missing or invalid.gpt-3.5-turbo
), and responses are displayed in the terminal../chatgpt -model gpt-4 -message "Hello, world!"
).Technical Notes for Implementation
Language and Dependencies:
github.com/sashabaranov/go-openai
(add viago get github.com/sashabaranov/go-openai
). This handles JSON serialization, HTTP requests, and authentication out-of-the-box. If avoiding third-party deps, implement raw HTTP calls usingnet/http
andencoding/json
.bufio
for interactive mode orflag
package for command-line args.Architecture Outline:
client.go
for OpenAI interactions (initialize client with API key fromos.Getenv("OPENAI_API_KEY")
).scanner := bufio.NewScanner(os.Stdin)
), append to a message history slice (type:[]openai.ChatCompletionMessage
), callclient.CreateChatCompletion
, and print the response (handle streaming if enabled via flag).gpt-3.5-turbo
. Support flag for model selection (e.g.,-model string
).log
package for warnings;fmt
for user-facing errors. Implement retries for transient errors (e.g., exponential backoff for rate limits).httptest
if implementing raw HTTP.go build -o chatgpt
. Run:./chatgpt
for interactive mode.Potential Risks/Considerations:
-temperature float
), max tokens (-max-tokens int
), or exporting chat logs.Estimation: 8 story points (4 hours development, 2 hours testing, 2 hours docs/review).
Attachments: [Link to engineering spec document if available].
Linked Issues: None.