From 00fc83c0819e8e5f0d122f44f4fb3f883cadc8f5 Mon Sep 17 00:00:00 2001 From: Test Date: Sat, 5 Sep 2026 00:46:40 -0700 Subject: [PATCH] feat: add JWT auth token support to LLM inference activities --- action/llm/client.go | 6 ++++++ action/llm_inference.go | 5 ++++- k8s/git-commit.yaml | 2 +- k8s/worker-deployment.yaml | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/action/llm/client.go b/action/llm/client.go index b49e495..007fa21 100644 --- a/action/llm/client.go +++ b/action/llm/client.go @@ -57,6 +57,7 @@ type MessageInput struct { Model statemachine.ModelSpec SystemPrompt string Messages []MessageParam + AuthToken string // Optional JWT token for authenticated endpoints } // 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") + // Add authentication header if token provided + if in.AuthToken != "" { + httpReq.Header.Set("Authorization", fmt.Sprintf("Bearer %s", in.AuthToken)) + } + // Send request resp, err := c.httpClient.Do(httpReq) if err != nil { diff --git a/action/llm_inference.go b/action/llm_inference.go index 128f199..e6980ae 100644 --- a/action/llm_inference.go +++ b/action/llm_inference.go @@ -15,6 +15,7 @@ type LLMInferenceInput struct { UserPrompt string `json:"user_prompt"` // User message Temperature float64 `json:"temperature,omitempty"` // LLM temperature (0-1) 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 @@ -53,7 +54,7 @@ func LLMInferenceActivity(ctx context.Context, in LLMInferenceInput) (LLMInferen } // 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{ Model: statemachine.ModelSpec{ @@ -66,6 +67,7 @@ func LLMInferenceActivity(ctx context.Context, in LLMInferenceInput) (LLMInferen Content: in.UserPrompt, }, }, + AuthToken: in.AuthToken, }) if err != nil { @@ -88,6 +90,7 @@ type LLMBatchInferenceInput struct { SystemPrompt string `json:"system_prompt"` Prompts []string `json:"prompts"` // List of user prompts Temperature float64 `json:"temperature,omitempty"` + AuthToken string `json:"auth_token,omitempty"` // JWT token for authenticated endpoints } // LLMBatchInferenceOutput is output from batch inference diff --git a/k8s/git-commit.yaml b/k8s/git-commit.yaml index b44e511..112aab1 100644 --- a/k8s/git-commit.yaml +++ b/k8s/git-commit.yaml @@ -9,6 +9,6 @@ metadata: app.kubernetes.io/name: poimen app.kubernetes.io/component: orchestrator data: - GIT_COMMIT: "e07b9504" # Updated automatically by CI/CD + GIT_COMMIT: "991c1f97" # Updated automatically by CI/CD GIT_BRANCH: "main" DEPLOYMENT_DATE: "2026-09-05" diff --git a/k8s/worker-deployment.yaml b/k8s/worker-deployment.yaml index 5464649..e2fe1e7 100644 --- a/k8s/worker-deployment.yaml +++ b/k8s/worker-deployment.yaml @@ -13,7 +13,7 @@ spec: labels: app: poimen-worker 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" spec: containers: