Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

657 B
Raw Blame
import { AgentRuntimeErrorType } from '@lobechat/types';
import { describe, expect, it } from 'vitest';

import { ModelRefusalError } from './modelRefusal';

describe('ModelRefusalError', () => {
  it('exposes the formal refusal type and diagnostics', () => {
    const diagnostics = {
      finishReason: 'refusal',
      model: 'fable',
      provider: 'lobehub',
    };
    const error = new ModelRefusalError(undefined, diagnostics);

    expect(error).toMatchObject({
      diagnostics,
      errorType: AgentRuntimeErrorType.ModelRefusal,
      message: 'The model declined to answer this request.',
      name: 'ModelRefusalError',
    });
  });
});