Skip to content

Commit 93dfa77

Browse files
committed
[openai] Include ResponseInfo in response
1 parent 946cc1f commit 93dfa77

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

  • aisdk/ai/provider/openai/internal/codec

aisdk/ai/provider/openai/internal/codec/decode.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"encoding/json"
55
"fmt"
66
"strings"
7+
"time"
78

89
"github.com/openai/openai-go/v2/responses"
910
"go.jetify.com/ai/api"
@@ -31,6 +32,11 @@ func DecodeResponse(msg *responses.Response) (*api.Response, error) {
3132

3233
// Create the response with the extracted fields
3334
resp := &api.Response{
35+
ResponseInfo: &api.ResponseInfo{
36+
ID: msg.ID,
37+
ModelID: string(msg.Model),
38+
Timestamp: time.Unix(int64(msg.CreatedAt), 0),
39+
},
3440
Content: content.Content,
3541
Usage: decodeUsage(msg.Usage),
3642
ProviderMetadata: decodeProviderMetadata(msg),

0 commit comments

Comments
 (0)