MCPcopy Create free account
hub / github.com/bricks-cloud/BricksLLM / DecorateRequest

Method DecorateRequest

internal/route/route.go:75–107  ·  view source on GitHub ↗
(provider string, body []byte, isEmbedding bool)

Source from the content-addressed store, hash-verified

73}
74
75func (s *Step) DecorateRequest(provider string, body []byte, isEmbedding bool) ([]byte, error) {
76 if provider != "azure" {
77 if isEmbedding {
78 embeddingsReq := &goopenai.EmbeddingRequest{}
79
80 err := json.Unmarshal(body, embeddingsReq)
81 if err != nil {
82 return nil, err
83 }
84
85 embeddingsReq.Model = goopenai.EmbeddingModel(s.Model)
86
87 return json.Marshal(embeddingsReq)
88 }
89 }
90
91 if !isEmbedding {
92 completionReq := &goopenai.ChatCompletionRequest{}
93
94 err := json.Unmarshal(body, completionReq)
95 if err != nil {
96 return nil, err
97 }
98
99 completionReq.Model = s.Model
100
101 s.DecorateChatCompletionRequest(completionReq)
102
103 return json.Marshal(completionReq)
104 }
105
106 return body, nil
107}
108
109func (s *Step) DecorateChatCompletionRequest(req *goopenai.ChatCompletionRequest) {
110 if s == nil {

Callers 1

RunStepsV2Method · 0.80

Calls 1

Tested by

no test coverage detected