feat: add JWT auth token support to LLM inference activities
ci / test (push) Failing after 2m14s

This commit is contained in:
Test
2026-09-05 00:47:22 -07:00
parent 0da90fdd7a
commit 00fc83c081
4 changed files with 12 additions and 3 deletions
+6
View File
@@ -57,6 +57,7 @@ type MessageInput struct {
Model statemachine.ModelSpec Model statemachine.ModelSpec
SystemPrompt string SystemPrompt string
Messages []MessageParam Messages []MessageParam
AuthToken string // Optional JWT token for authenticated endpoints
} }
// MessageParam represents a message parameter. // MessageParam represents a message parameter.
@@ -136,6 +137,11 @@ func (c *OpenAIClient) CreateMessage(ctx context.Context, in MessageInput) (stri
httpReq.Header.Set("Content-Type", "application/json") httpReq.Header.Set("Content-Type", "application/json")
// Add authentication header if token provided
if in.AuthToken != "" {
httpReq.Header.Set("Authorization", fmt.Sprintf("Bearer %s", in.AuthToken))
}
// Send request // Send request
resp, err := c.httpClient.Do(httpReq) resp, err := c.httpClient.Do(httpReq)
if err != nil { if err != nil {
+4 -1
View File
@@ -15,6 +15,7 @@ type LLMInferenceInput struct {
UserPrompt string `json:"user_prompt"` // User message UserPrompt string `json:"user_prompt"` // User message
Temperature float64 `json:"temperature,omitempty"` // LLM temperature (0-1) Temperature float64 `json:"temperature,omitempty"` // LLM temperature (0-1)
MaxTokens int `json:"max_tokens,omitempty"` // Max output tokens MaxTokens int `json:"max_tokens,omitempty"` // Max output tokens
AuthToken string `json:"auth_token,omitempty"` // JWT token for authenticated endpoints
} }
// LLMInferenceOutput is output from LLMInferenceActivity // LLMInferenceOutput is output from LLMInferenceActivity
@@ -53,7 +54,7 @@ func LLMInferenceActivity(ctx context.Context, in LLMInferenceInput) (LLMInferen
} }
// Call LLM // Call LLM
logger.logf("info", "Calling LLM API (model=%s, prompt_len=%d)", in.Model, len(in.UserPrompt)) logger.logf("info", "Calling LLM API (model=%s, prompt_len=%d, auth=%v)", in.Model, len(in.UserPrompt), in.AuthToken != "")
response, err := client.CreateMessage(ctx, llm.MessageInput{ response, err := client.CreateMessage(ctx, llm.MessageInput{
Model: statemachine.ModelSpec{ Model: statemachine.ModelSpec{
@@ -66,6 +67,7 @@ func LLMInferenceActivity(ctx context.Context, in LLMInferenceInput) (LLMInferen
Content: in.UserPrompt, Content: in.UserPrompt,
}, },
}, },
AuthToken: in.AuthToken,
}) })
if err != nil { if err != nil {
@@ -88,6 +90,7 @@ type LLMBatchInferenceInput struct {
SystemPrompt string `json:"system_prompt"` SystemPrompt string `json:"system_prompt"`
Prompts []string `json:"prompts"` // List of user prompts Prompts []string `json:"prompts"` // List of user prompts
Temperature float64 `json:"temperature,omitempty"` Temperature float64 `json:"temperature,omitempty"`
AuthToken string `json:"auth_token,omitempty"` // JWT token for authenticated endpoints
} }
// LLMBatchInferenceOutput is output from batch inference // LLMBatchInferenceOutput is output from batch inference
+1 -1
View File
@@ -9,6 +9,6 @@ metadata:
app.kubernetes.io/name: poimen app.kubernetes.io/name: poimen
app.kubernetes.io/component: orchestrator app.kubernetes.io/component: orchestrator
data: data:
GIT_COMMIT: "e07b9504" # Updated automatically by CI/CD GIT_COMMIT: "991c1f97" # Updated automatically by CI/CD
GIT_BRANCH: "main" GIT_BRANCH: "main"
DEPLOYMENT_DATE: "2026-09-05" DEPLOYMENT_DATE: "2026-09-05"
+1 -1
View File
@@ -13,7 +13,7 @@ spec:
labels: labels:
app: poimen-worker app: poimen-worker
annotations: annotations:
git-commit: "e07b9504" # ✅ Updated on each push, triggers rolling restart git-commit: "991c1f97" # ✅ Updated on each push, triggers rolling restart
deployment-date: "2026-09-05" deployment-date: "2026-09-05"
spec: spec:
containers: containers: