Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test whether IHttpLlmApplication covers ILlmApplication #138

Merged
merged 7 commits into from
Feb 12, 2025
54 changes: 54 additions & 0 deletions test/features/llm/validate_llm_application_type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import {
HttpLlm,
IHttpLlmApplication,
ILlmApplication,
ILlmSchema,
OpenApi,
} from "@samchon/openapi";
import fs from "fs";
import { Singleton } from "tstl";
import typia from "typia";

import { TestGlobal } from "../../TestGlobal";

export const test_chatgpt_application_type = (): void => {
const http: IHttpLlmApplication<"chatgpt"> = application("chatgpt");
const classic: ILlmApplication<"chatgpt"> = http;
typia.assert(classic);
};

export const test_claude_application_type = (): void => {
const http: IHttpLlmApplication<"claude"> = application("claude");
const classic: ILlmApplication<"claude"> = http;
typia.assert(classic);
};

export const test_llama_application_type = (): void => {
const http: IHttpLlmApplication<"llama"> = application("llama");
const classic: ILlmApplication<"llama"> = http;
typia.assert(classic);
};

export const test_llm_v30_application_type = (): void => {
const http: IHttpLlmApplication<"3.0"> = application("3.0");
const classic: ILlmApplication<"3.0"> = http;
typia.assert(classic);
};

export const test_llm_v31_application_type = (): void => {
const http: IHttpLlmApplication<"3.1"> = application("3.1");
const classic: ILlmApplication<"3.1"> = http;
typia.assert(classic);
};

const application = <Model extends ILlmSchema.Model>(model: Model) =>
HttpLlm.application({
model,
document: document.get(),
});

const document = new Singleton(() =>
typia.json.assertParse<OpenApi.IDocument>(
fs.readFileSync(`${TestGlobal.ROOT}/examples/v3.1/shopping.json`, "utf8"),
),
);