-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Limit
IHttpLlmFunction.description
length under 1,024.
As OpenAI (ChatGPT) does not allow over 1,024 length description property on the tool calling's function definition, `@samchon/openapi` also blocks it on the `IHttpLlmApplication` composing process. In the same way, `typia.llm.application<App, Model>()` and `typia.llm.applicationOfValidate<App, Model>()` functions will block the 1,024 length over description too.
- Loading branch information
Showing
30 changed files
with
164 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
test/features/llm/chatgpt/test_chatgpt_function_calling_description_length.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import typia from "typia"; | ||
|
||
import { ChatGptFunctionCaller } from "../../../utils/ChatGptFunctionCaller"; | ||
|
||
export const test_chatgpt_function_calling_description_length = async () => { | ||
await ChatGptFunctionCaller.test({ | ||
config: { | ||
reference: true, | ||
}, | ||
name: "testLength", | ||
description: "가".repeat(1_024), | ||
collection: typia.json.schemas<[{ input: IPerson }]>(), | ||
validate: typia.createValidate<{ input: IPerson }>(), | ||
texts: [ | ||
{ | ||
role: "assistant", | ||
content: SYSTEM_MESSAGE, | ||
}, | ||
{ | ||
role: "user", | ||
content: USER_MESSAGE, | ||
}, | ||
], | ||
handleCompletion: async (input) => { | ||
typia.assert<IPerson>(input); | ||
}, | ||
}); | ||
}; | ||
|
||
interface IPerson { | ||
name: string; | ||
age: number; | ||
} | ||
|
||
const SYSTEM_MESSAGE = | ||
"You are a helpful customer support assistant. Use the supplied tools to assist the user."; | ||
|
||
const USER_MESSAGE = | ||
"Just enroll a person whose name and age values 'John Doe' and 42 years old."; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
test/features/llm/chatgpt/test_chatgpt_function_calling_name_length.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import typia from "typia"; | ||
|
||
import { ChatGptFunctionCaller } from "../../../utils/ChatGptFunctionCaller"; | ||
|
||
export const test_chatgpt_function_calling_name_length = async () => { | ||
await ChatGptFunctionCaller.test({ | ||
config: { | ||
reference: true, | ||
}, | ||
name: "A".repeat(64), | ||
description: "Enroll a person information.", | ||
collection: typia.json.schemas<[{ input: IPerson }]>(), | ||
validate: typia.createValidate<{ input: IPerson }>(), | ||
texts: [ | ||
{ | ||
role: "assistant", | ||
content: SYSTEM_MESSAGE, | ||
}, | ||
{ | ||
role: "user", | ||
content: USER_MESSAGE, | ||
}, | ||
], | ||
handleCompletion: async (input) => { | ||
typia.assert<IPerson>(input); | ||
}, | ||
}); | ||
}; | ||
|
||
interface IPerson { | ||
name: string; | ||
age: number; | ||
} | ||
|
||
const SYSTEM_MESSAGE = | ||
"You are a helpful customer support assistant. Use the supplied tools to assist the user."; | ||
|
||
const USER_MESSAGE = | ||
"Just enroll a person whose name and age values 'John Doe' and 42 years old."; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.