- Add authoring adapter for openai integration - Move 02+01_iop_authoring_bridge to archive - Update scheduler jobs and workflow lifecycle - Enhance openai client and model definitions
46 lines
1.1 KiB
Go
46 lines
1.1 KiB
Go
package model
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
)
|
|
|
|
type Client interface {
|
|
Generate(ctx context.Context, input GenerateInput) (GenerateResult, error)
|
|
}
|
|
|
|
// WorkspaceMetadata carries workspace-bound authoring context passed as
|
|
// metadata.workspace in the /v1/responses payload. Fields here map directly
|
|
// to IOP Edge workspace routing fields so the receiving agent can resolve the
|
|
// correct slot checkout without CLI-level invocation by NomadCode.
|
|
type WorkspaceMetadata struct {
|
|
Path string `json:"path"`
|
|
SourceBranch string `json:"source_branch,omitempty"`
|
|
Provider string `json:"provider,omitempty"`
|
|
WorkItemID string `json:"work_item_id,omitempty"`
|
|
}
|
|
|
|
type GenerateInput struct {
|
|
Model string
|
|
Instructions string
|
|
Input string
|
|
Metadata map[string]string
|
|
WorkspaceMetadata *WorkspaceMetadata
|
|
MaxOutputTokens int
|
|
Temperature *float64
|
|
TopP *float64
|
|
}
|
|
|
|
type GenerateResult struct {
|
|
ID string
|
|
Model string
|
|
Text string
|
|
Usage Usage
|
|
Raw json.RawMessage
|
|
}
|
|
|
|
type Usage struct {
|
|
InputTokens int
|
|
OutputTokens int
|
|
TotalTokens int
|
|
}
|