Skip to content

Commit 7c79d29

Browse files
authored
feat(mistral): Instrument classification and moderation APIs (#1947)
Fixes #1917
1 parent 89d23f1 commit 7c79d29

24 files changed

Lines changed: 1211 additions & 4 deletions

.changeset/petite-pugs-relax.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"braintrust": minor
3+
---
4+
5+
feat(mistral): Instrument classification and moderation APIs

e2e/scenarios/mistral-instrumentation/__snapshots__/mistral-v1-10-0.log-payloads.json

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,5 +500,65 @@
500500
"type": "embedding"
501501
},
502502
"span_id": "<span:25>"
503+
},
504+
{
505+
"has_input": false,
506+
"has_output": false,
507+
"input": null,
508+
"metadata": {
509+
"operation": "classifiers-moderate"
510+
},
511+
"metric_keys": [],
512+
"output": null,
513+
"span_id": "<span:26>"
514+
},
515+
{
516+
"has_input": true,
517+
"has_output": true,
518+
"input": "<string>",
519+
"metadata": {
520+
"model": "mistral-moderation-2603",
521+
"provider": "mistral"
522+
},
523+
"metric_keys": [],
524+
"output": {
525+
"choice_count": 1,
526+
"finish_reason": null,
527+
"type": "array"
528+
},
529+
"span_id": "<span:27>"
530+
},
531+
{
532+
"has_input": false,
533+
"has_output": false,
534+
"input": null,
535+
"metadata": {
536+
"operation": "classifiers-moderate-chat"
537+
},
538+
"metric_keys": [],
539+
"output": null,
540+
"span_id": "<span:28>"
541+
},
542+
{
543+
"has_input": true,
544+
"has_output": true,
545+
"input": {
546+
"item_count": 1,
547+
"roles": [
548+
"user"
549+
],
550+
"type": "messages"
551+
},
552+
"metadata": {
553+
"model": "mistral-moderation-2603",
554+
"provider": "mistral"
555+
},
556+
"metric_keys": [],
557+
"output": {
558+
"choice_count": 1,
559+
"finish_reason": null,
560+
"type": "array"
561+
},
562+
"span_id": "<span:29>"
503563
}
504564
]

e2e/scenarios/mistral-instrumentation/__snapshots__/mistral-v1-10-0.span-events.json

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,5 +449,67 @@
449449
"<span:24>"
450450
],
451451
"type": "llm"
452+
},
453+
{
454+
"has_input": false,
455+
"has_output": false,
456+
"metadata": {
457+
"operation": "classifiers-moderate"
458+
},
459+
"metric_keys": [],
460+
"name": "mistral-classifiers-moderate-operation",
461+
"root_span_id": "<span:1>",
462+
"span_id": "<span:26>",
463+
"span_parents": [
464+
"<span:1>"
465+
],
466+
"type": null
467+
},
468+
{
469+
"has_input": true,
470+
"has_output": true,
471+
"metadata": {
472+
"model": "mistral-moderation-2603",
473+
"provider": "mistral"
474+
},
475+
"metric_keys": [],
476+
"name": "mistral.classifiers.moderate",
477+
"root_span_id": "<span:1>",
478+
"span_id": "<span:27>",
479+
"span_parents": [
480+
"<span:26>"
481+
],
482+
"type": "llm"
483+
},
484+
{
485+
"has_input": false,
486+
"has_output": false,
487+
"metadata": {
488+
"operation": "classifiers-moderate-chat"
489+
},
490+
"metric_keys": [],
491+
"name": "mistral-classifiers-moderate-chat-operation",
492+
"root_span_id": "<span:1>",
493+
"span_id": "<span:28>",
494+
"span_parents": [
495+
"<span:1>"
496+
],
497+
"type": null
498+
},
499+
{
500+
"has_input": true,
501+
"has_output": true,
502+
"metadata": {
503+
"model": "mistral-moderation-2603",
504+
"provider": "mistral"
505+
},
506+
"metric_keys": [],
507+
"name": "mistral.classifiers.moderateChat",
508+
"root_span_id": "<span:1>",
509+
"span_id": "<span:29>",
510+
"span_parents": [
511+
"<span:28>"
512+
],
513+
"type": "llm"
452514
}
453515
]

e2e/scenarios/mistral-instrumentation/__snapshots__/mistral-v1-14-1.log-payloads.json

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,5 +500,65 @@
500500
"type": "embedding"
501501
},
502502
"span_id": "<span:25>"
503+
},
504+
{
505+
"has_input": false,
506+
"has_output": false,
507+
"input": null,
508+
"metadata": {
509+
"operation": "classifiers-moderate"
510+
},
511+
"metric_keys": [],
512+
"output": null,
513+
"span_id": "<span:26>"
514+
},
515+
{
516+
"has_input": true,
517+
"has_output": true,
518+
"input": "<string>",
519+
"metadata": {
520+
"model": "mistral-moderation-2603",
521+
"provider": "mistral"
522+
},
523+
"metric_keys": [],
524+
"output": {
525+
"choice_count": 1,
526+
"finish_reason": null,
527+
"type": "array"
528+
},
529+
"span_id": "<span:27>"
530+
},
531+
{
532+
"has_input": false,
533+
"has_output": false,
534+
"input": null,
535+
"metadata": {
536+
"operation": "classifiers-moderate-chat"
537+
},
538+
"metric_keys": [],
539+
"output": null,
540+
"span_id": "<span:28>"
541+
},
542+
{
543+
"has_input": true,
544+
"has_output": true,
545+
"input": {
546+
"item_count": 1,
547+
"roles": [
548+
"user"
549+
],
550+
"type": "messages"
551+
},
552+
"metadata": {
553+
"model": "mistral-moderation-2603",
554+
"provider": "mistral"
555+
},
556+
"metric_keys": [],
557+
"output": {
558+
"choice_count": 1,
559+
"finish_reason": null,
560+
"type": "array"
561+
},
562+
"span_id": "<span:29>"
503563
}
504564
]

e2e/scenarios/mistral-instrumentation/__snapshots__/mistral-v1-14-1.span-events.json

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,5 +449,67 @@
449449
"<span:24>"
450450
],
451451
"type": "llm"
452+
},
453+
{
454+
"has_input": false,
455+
"has_output": false,
456+
"metadata": {
457+
"operation": "classifiers-moderate"
458+
},
459+
"metric_keys": [],
460+
"name": "mistral-classifiers-moderate-operation",
461+
"root_span_id": "<span:1>",
462+
"span_id": "<span:26>",
463+
"span_parents": [
464+
"<span:1>"
465+
],
466+
"type": null
467+
},
468+
{
469+
"has_input": true,
470+
"has_output": true,
471+
"metadata": {
472+
"model": "mistral-moderation-2603",
473+
"provider": "mistral"
474+
},
475+
"metric_keys": [],
476+
"name": "mistral.classifiers.moderate",
477+
"root_span_id": "<span:1>",
478+
"span_id": "<span:27>",
479+
"span_parents": [
480+
"<span:26>"
481+
],
482+
"type": "llm"
483+
},
484+
{
485+
"has_input": false,
486+
"has_output": false,
487+
"metadata": {
488+
"operation": "classifiers-moderate-chat"
489+
},
490+
"metric_keys": [],
491+
"name": "mistral-classifiers-moderate-chat-operation",
492+
"root_span_id": "<span:1>",
493+
"span_id": "<span:28>",
494+
"span_parents": [
495+
"<span:1>"
496+
],
497+
"type": null
498+
},
499+
{
500+
"has_input": true,
501+
"has_output": true,
502+
"metadata": {
503+
"model": "mistral-moderation-2603",
504+
"provider": "mistral"
505+
},
506+
"metric_keys": [],
507+
"name": "mistral.classifiers.moderateChat",
508+
"root_span_id": "<span:1>",
509+
"span_id": "<span:29>",
510+
"span_parents": [
511+
"<span:28>"
512+
],
513+
"type": "llm"
452514
}
453515
]

e2e/scenarios/mistral-instrumentation/__snapshots__/mistral-v1-15-1.log-payloads.json

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,5 +500,65 @@
500500
"type": "embedding"
501501
},
502502
"span_id": "<span:25>"
503+
},
504+
{
505+
"has_input": false,
506+
"has_output": false,
507+
"input": null,
508+
"metadata": {
509+
"operation": "classifiers-moderate"
510+
},
511+
"metric_keys": [],
512+
"output": null,
513+
"span_id": "<span:26>"
514+
},
515+
{
516+
"has_input": true,
517+
"has_output": true,
518+
"input": "<string>",
519+
"metadata": {
520+
"model": "mistral-moderation-2603",
521+
"provider": "mistral"
522+
},
523+
"metric_keys": [],
524+
"output": {
525+
"choice_count": 1,
526+
"finish_reason": null,
527+
"type": "array"
528+
},
529+
"span_id": "<span:27>"
530+
},
531+
{
532+
"has_input": false,
533+
"has_output": false,
534+
"input": null,
535+
"metadata": {
536+
"operation": "classifiers-moderate-chat"
537+
},
538+
"metric_keys": [],
539+
"output": null,
540+
"span_id": "<span:28>"
541+
},
542+
{
543+
"has_input": true,
544+
"has_output": true,
545+
"input": {
546+
"item_count": 1,
547+
"roles": [
548+
"user"
549+
],
550+
"type": "messages"
551+
},
552+
"metadata": {
553+
"model": "mistral-moderation-2603",
554+
"provider": "mistral"
555+
},
556+
"metric_keys": [],
557+
"output": {
558+
"choice_count": 1,
559+
"finish_reason": null,
560+
"type": "array"
561+
},
562+
"span_id": "<span:29>"
503563
}
504564
]

0 commit comments

Comments
 (0)