Skip to content

Commit 6ca40b3

Browse files
authored
Merge pull request #356 from krissetto/dmr-tool-desc-workaround
Workaround for DMR requiring tool descriptions
2 parents 88b8520 + 1de1190 commit 6ca40b3

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

pkg/model/provider/dmr/client.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,9 +333,15 @@ func (c *Client) CreateChatCompletionStream(ctx context.Context, messages []chat
333333
slog.Debug("Adding tools to DMR request", "tool_count", len(requestTools))
334334
request.Tools = make([]openai.Tool, len(requestTools))
335335
for i, tool := range requestTools {
336+
// DMR requires the `description` key to be present; ensure a non-empty value
337+
// NOTE(krissetto): workaround, remove when fixed upstream, this shouldn't be necceessary
338+
desc := tool.Function.Description
339+
if desc == "" {
340+
desc = "Function " + tool.Function.Name
341+
}
336342
fd := &openai.FunctionDefinition{
337343
Name: tool.Function.Name,
338-
Description: tool.Function.Description,
344+
Description: desc,
339345
Strict: tool.Function.Strict,
340346
}
341347
if len(tool.Function.Parameters.Properties) == 0 {

0 commit comments

Comments
 (0)