(log *zap.Logger, data []byte, prod, private bool)
| 35 | } |
| 36 | |
| 37 | func logAssistantResponse(log *zap.Logger, data []byte, prod, private bool) { |
| 38 | a := &goopenai.Assistant{} |
| 39 | err := json.Unmarshal(data, a) |
| 40 | if err != nil { |
| 41 | logError(log, "error when unmarshalling assistant response", prod, err) |
| 42 | return |
| 43 | } |
| 44 | |
| 45 | if prod { |
| 46 | fields := []zapcore.Field{ |
| 47 | zap.String("object", a.Object), |
| 48 | zap.Int64("created_at", a.CreatedAt), |
| 49 | zap.String("Model", a.Model), |
| 50 | zap.Any("tools", a.Tools), |
| 51 | zap.Stringp("name", a.Name), |
| 52 | zap.Stringp("description", a.Description), |
| 53 | } |
| 54 | |
| 55 | if !private && a.Instructions != nil { |
| 56 | fields = append(fields, zap.String("instructions", *a.Instructions)) |
| 57 | } |
| 58 | |
| 59 | log.Info("openai create assistant response", fields...) |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | func logRetrieveAssistantRequest(log *zap.Logger, prod bool, assistantId string) { |
| 64 | if prod { |
no test coverage detected