Skip to content

Commit 962495d

Browse files
nicohrubecclaude
andcommitted
feat(mistral): Drop fim (text_completion) from initial scope
Exclude the fim endpoints for now — `text_completion` is not yet used by any other AI integration, so defer it to a follow-up. Remaining scope: chat, embeddings, and agents. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent cd4eb98 commit 962495d

6 files changed

Lines changed: 1 addition & 176 deletions

File tree

‎dev-packages/node-integration-tests/suites/tracing/mistral/scenario-fim.mjs‎

Lines changed: 0 additions & 125 deletions
This file was deleted.

‎dev-packages/node-integration-tests/suites/tracing/mistral/test.ts‎

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -196,32 +196,4 @@ describe('Mistral integration', () => {
196196
.completed();
197197
});
198198
});
199-
200-
createEsmAndCjsTests(__dirname, 'scenario-fim.mjs', 'instrument.mjs', (createRunner, test) => {
201-
test('creates fim text_completion spans', async () => {
202-
await createRunner()
203-
.expect({
204-
span: container => {
205-
const fimSpan = container.items.find(s => s.attributes[GEN_AI_RESPONSE_ID]?.value === 'fimcmpl-mock123');
206-
expect(fimSpan).toBeDefined();
207-
expect(fimSpan!.name).toBe('text_completion codestral-latest');
208-
expect(fimSpan!.status).toBe('ok');
209-
expect(fimSpan!.attributes[GEN_AI_OPERATION_NAME]?.value).toBe('text_completion');
210-
expect(fimSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP]?.value).toBe('gen_ai.text_completion');
211-
expect(fimSpan!.attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]?.value).toBe(ORIGIN);
212-
expect(fimSpan!.attributes[GEN_AI_PROVIDER_NAME]?.value).toBe(PROVIDER);
213-
expect(fimSpan!.attributes[GEN_AI_REQUEST_MODEL]?.value).toBe('codestral-latest');
214-
expect(fimSpan!.attributes[GEN_AI_USAGE_TOTAL_TOKENS]?.value).toBe(15);
215-
216-
const fimStreamSpan = container.items.find(
217-
s => s.attributes[GEN_AI_RESPONSE_ID]?.value === 'fimcmpl-stream-123',
218-
);
219-
expect(fimStreamSpan).toBeDefined();
220-
expect(fimStreamSpan!.attributes[GEN_AI_RESPONSE_STREAMING]?.value).toBe(true);
221-
},
222-
})
223-
.start()
224-
.completed();
225-
});
226-
});
227199
});

‎packages/server-utils/src/ai/mistral/constants.ts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,4 @@ export const MISTRAL_METHOD_REGISTRY = {
1010
'embeddings.create': { operation: 'embeddings' },
1111
'agents.complete': { operation: 'invoke_agent' },
1212
'agents.stream': { operation: 'invoke_agent', streaming: true },
13-
'fim.complete': { operation: 'text_completion' },
14-
'fim.stream': { operation: 'text_completion', streaming: true },
1513
} as const satisfies InstrumentedMethodRegistry;

‎packages/server-utils/src/ai/mistral/index.ts‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,6 @@ export function addRequestAttributes(span: Span, params: Record<string, unknown>
6565
return;
6666
}
6767

68-
// FIM completions carry a raw `prompt` string rather than a messages array.
69-
if (operationName === 'text_completion') {
70-
if (typeof params.prompt === 'string' && params.prompt.length > 0) {
71-
span.setAttribute(GEN_AI_INPUT_MESSAGES, stringify(params.prompt));
72-
}
73-
return;
74-
}
75-
7668
const src = 'messages' in params ? params.messages : undefined;
7769
if (!src || (Array.isArray(src) && src.length === 0)) {
7870
return;

‎packages/server-utils/src/integrations/mistral.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ const INSTRUMENTED_CHANNELS = [
2727
{ channel: CHANNELS.MISTRAL_CHAT, operation: 'chat' },
2828
{ channel: CHANNELS.MISTRAL_EMBEDDINGS, operation: 'embeddings' },
2929
{ channel: CHANNELS.MISTRAL_AGENTS, operation: 'invoke_agent' },
30-
{ channel: CHANNELS.MISTRAL_FIM, operation: 'text_completion' },
3130
] as const;
3231

3332
/**
@@ -129,7 +128,7 @@ function wrapStreamResult(span: Span, data: MistralChannelContext, options: Mist
129128

130129
/**
131130
* Diagnostics-channel-based Mistral integration. Subscribes to the `orchestrion:@mistralai/mistralai:*`
132-
* diagnostics_channels injected into the SDK's chat, embeddings, agents and fim methods, so it requires
131+
* diagnostics_channels injected into the SDK's chat, embeddings and agents methods, so it requires
133132
* the Sentry runtime hook or bundler plugin.
134133
*/
135134
export const mistralAIIntegration = defineIntegration(_mistralAIIntegration);

‎packages/server-utils/src/orchestrion/config/mistral.ts‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,6 @@ export const mistralConfig = [
3333
module: { ...MODULE, filePath: 'esm/sdk/agents.js' },
3434
functionQuery: { className: 'Agents', methodName: 'stream', kind: 'Auto' as const },
3535
},
36-
{
37-
channelName: 'fim',
38-
module: { ...MODULE, filePath: 'esm/sdk/fim.js' },
39-
functionQuery: { className: 'Fim', methodName: 'complete', kind: 'Auto' as const },
40-
},
41-
{
42-
channelName: 'fim',
43-
module: { ...MODULE, filePath: 'esm/sdk/fim.js' },
44-
functionQuery: { className: 'Fim', methodName: 'stream', kind: 'Auto' as const },
45-
},
4636
] satisfies InstrumentationConfig[];
4737

4838
export const mistralModuleNames = getModuleNames(mistralConfig);
@@ -51,5 +41,4 @@ export const mistralChannels = {
5141
MISTRAL_CHAT: 'orchestrion:@mistralai/mistralai:chat',
5242
MISTRAL_EMBEDDINGS: 'orchestrion:@mistralai/mistralai:embeddings',
5343
MISTRAL_AGENTS: 'orchestrion:@mistralai/mistralai:agents',
54-
MISTRAL_FIM: 'orchestrion:@mistralai/mistralai:fim',
5544
} as const;

0 commit comments

Comments
 (0)