feat: [ML-531]: Introduce conversations into request DTOs for AI Devops (#3239)

* Merge branch 'main' into yogesh/ML-531-conversationsDTO
* Fixed Lint issues
* transfer fields from handler to controller
* Add to controller object
* Add conversation DTOS
BT-10437
Yogesh Chauhan 2025-01-09 16:05:51 +00:00 committed by Harness
parent 0ce1cde6c8
commit a94be356c4
4 changed files with 46 additions and 7 deletions

View File

@ -27,7 +27,9 @@ func (c *Controller) GeneratePipelineStep(
in *controllertypes.GeneratePipelineStepInput,
) (*controllertypes.GeneratePipelineStepOutput, error) {
generateRequest := &aitypes.PipelineStepGenerateRequest{
Prompt: in.Prompt,
Prompt: in.Prompt,
Metadata: in.Metadata,
Conversation: in.Conversation,
}
output, err := c.intelligence.GeneratePipelineStep(ctx, generateRequest)

View File

@ -21,4 +21,30 @@ type Suggestion struct {
Suggestion string
}
// Enum type for Role.
type Role string
const (
RoleUser Role = "user"
RoleAssistant Role = "assistant"
)
// Enum type for Message Type.
type MessageType string
const (
TypeText MessageType = "text"
TypeYAML MessageType = "yaml"
)
type Conversation struct {
Role Role `json:"role"`
Message Message `json:"message"`
}
type Message struct {
Type MessageType `json:"type"`
Data string `json:"data"`
}
// Additional common structs can be defined here as needed.

View File

@ -20,7 +20,9 @@ type PipelineStepData struct {
// create.
type GeneratePipelineStepInput struct {
Prompt string `json:"prompt"`
Prompt string `json:"prompt"`
Metadata map[string]string `json:"metadata"`
Conversation []Conversation `json:"conversation"`
}
type GeneratePipelineStepOutput struct {
@ -30,8 +32,9 @@ type GeneratePipelineStepOutput struct {
// update.
type UpdatePipelineStepInput struct {
Prompt string `json:"prompt"`
Data PipelineStepData `json:"data"`
Prompt string `json:"prompt"`
Data PipelineStepData `json:"data"`
Conversation []Conversation `json:"conversation"`
}
type UpdatePipelineStepOutput struct {

View File

@ -14,8 +14,14 @@
package types
import (
"github.com/harness/gitness/app/api/controller/aiagent/types"
)
type PipelineStepGenerateRequest struct {
Prompt string
Prompt string
Metadata map[string]string `json:"metadata"`
Conversation []types.Conversation `json:"conversation"`
}
type PipelineStepGenerateResponse struct {
@ -23,8 +29,10 @@ type PipelineStepGenerateResponse struct {
}
type PipelineStepUpdateRequest struct {
Prompt string
Step string
Prompt string
Step string
Metadata map[string]string `json:"metadata"`
Conversation []types.Conversation `json:"conversation"`
}
type PipelineStepUpdateResponse struct {