chore(vendor): import pi 1.3.0
Imported as a linear vendor commit so forge rebases do not replay the upstream root tree. git-subtree-dir: third_party/pi git-subtree-split: 71023aec1546d6d677a65669c5665c0927ce0dd0
This commit is contained in:
1 parent
719370c8f7
commit
6081e3e325
1743 files changed
+205459
-131704
No files matched your search
@@ -0,0 +1,40 @@
|
||||
import type { Static } from "typebox";
|
||||
import { Compile } from "typebox/compile";
|
||||
import { describe, expect, expectTypeOf, it } from "vitest";
|
||||
import {
|
||||
AnthropicMessagesCompatSchema,
|
||||
BedrockCompatSchema,
|
||||
OpenAICompletionsCompatSchema,
|
||||
OpenAIResponsesCompatSchema,
|
||||
ProviderCompatSchema,
|
||||
} from "../src/providers/compat-schema.ts";
|
||||
|
||||
type ProviderCompat = Static<typeof ProviderCompatSchema>;
|
||||
|
||||
describe("compatibility schemas", () => {
|
||||
it("preserves property types in the provider superset", () => {
|
||||
expectTypeOf<ProviderCompat["supportsStore"]>().toEqualTypeOf<boolean | undefined>();
|
||||
expectTypeOf<ProviderCompat["sessionAffinityFormat"]>().toEqualTypeOf<
|
||||
"openai" | "openai-nosession" | "openrouter" | undefined
|
||||
>();
|
||||
});
|
||||
|
||||
it("preserves API-specific defaults", () => {
|
||||
const completionsDefaults = Compile(OpenAICompletionsCompatSchema).Default({});
|
||||
expect(completionsDefaults).not.toHaveProperty("thinkingFormat");
|
||||
expect(completionsDefaults).not.toHaveProperty("supportsLongCacheRetention");
|
||||
expect(Compile(OpenAIResponsesCompatSchema).Default({})).toMatchObject({ supportsDeveloperRole: true });
|
||||
const anthropicDefaults = Compile(AnthropicMessagesCompatSchema).Default({});
|
||||
expect(anthropicDefaults).not.toHaveProperty("sendSessionAffinityHeaders");
|
||||
expect(anthropicDefaults).toMatchObject({ supportsLongCacheRetention: true });
|
||||
expect(Compile(BedrockCompatSchema).Default({})).toMatchObject({ supportsStrictMode: false });
|
||||
});
|
||||
|
||||
it("does not assign API-specific defaults to the provider superset", () => {
|
||||
const defaults = Compile(ProviderCompatSchema).Default({});
|
||||
expect(defaults).not.toHaveProperty("supportsDeveloperRole");
|
||||
expect(defaults).not.toHaveProperty("sendSessionAffinityHeaders");
|
||||
expect(defaults).not.toHaveProperty("supportsLongCacheRetention");
|
||||
expect(defaults).not.toHaveProperty("supportsStrictMode");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user