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

Close #760: IJsonApplication<Version, Types> #1239

Merged
merged 6 commits into from
Aug 23, 2024
Merged

Conversation

samchon
Copy link
Owner

@samchon samchon commented Aug 22, 2024

@ryoppippi Needs your review.

Also, newly added tag must be such dynamic unique symbol type?

May I change it to just a static property like __types: Types[]?

@samchon samchon added the enhancement New feature or request label Aug 22, 2024
@samchon samchon self-assigned this Aug 22, 2024
Copy link

pkg-pr-new bot commented Aug 22, 2024

commit: 7b54283

npm i https://pkg.pr.new/typia@1239

Open in Stackblitz

Copy link
Contributor

@ryoppippi ryoppippi left a comment

@samchon
Copy link
Owner Author

samchon commented Aug 23, 2024

@ryoppippi static symbol? It means the static property right?

If you think below is okay, it would be published to v6.10.0 with your CLI enhancement.

import type { OpenApi, OpenApiV3 } from "@samchon/openapi";

export type IJsonApplication<
  Version extends "3.0" | "3.1" = "3.1",
  Types = unknown[],
> = Version extends "3.0"
  ? IJsonApplication.IV3_0<Types>
  : IJsonApplication.IV3_1<Types>;
export namespace IJsonApplication {
  export interface IV3_0<Types = unknown[]> {
    version: "3.0";
    schemas: OpenApiV3.IJsonSchema[];
    components: OpenApiV3.IComponents;
    __types?: Types;
  }
  export interface IV3_1<Types = unknown[]> {
    version: "3.1";
    components: OpenApi.IComponents;
    schemas: OpenApi.IJsonSchema[];
    __types?: Types;
  }
}

@samchon samchon changed the title Complement #1210: make unique symbol typed [tag] property to be IJsonApplication optional. Close #760: IJsonApplication<Version, Types> Aug 23, 2024
Copy link

socket-security bot commented Aug 23, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@types/[email protected] None 0 5.1 kB types
npm/@types/[email protected] None 0 2.1 MB types
npm/@types/[email protected] None 0 6.74 kB types
npm/[email protected] environment Transitive: filesystem +12 253 kB cohara87
npm/[email protected] environment, network 0 99 MB vscode-bot
npm/[email protected] Transitive: environment, filesystem +20 868 kB iamvishnusankar
npm/[email protected] environment, filesystem, network, shell, unsafe +22 1.2 GB vercel-release-bot
npm/[email protected] Transitive: environment, eval +23 4.75 MB quietshu
npm/[email protected] environment Transitive: eval, filesystem, network, shell +282 153 MB quietshu
npm/[email protected] environment 0 18.9 kB jinder
npm/[email protected] None 0 15.3 kB cwmma
npm/[email protected] filesystem, network +11 3 MB google-wombot
npm/[email protected] environment +2 4.61 MB react-bot
npm/[email protected] environment +1 324 kB react-bot
npm/[email protected] filesystem +2 895 kB linusu
npm/[email protected] None +3 572 kB samchon
npm/[email protected] filesystem Transitive: environment, unsafe +9 790 kB johnnyreilly
npm/[email protected] filesystem 0 15 kB killerjulian
npm/[email protected] Transitive: environment, filesystem +13 15.4 MB typedoc-bot
npm/[email protected] None 0 4.06 MB samchon
npm/[email protected] Transitive: environment, filesystem, shell +40 10.4 MB samchon
npm/[email protected] None 0 123 kB ctavan

🚮 Removed packages: npm/@rollup/[email protected]), npm/@rollup/[email protected]), npm/@rollup/[email protected]), npm/@samchon/[email protected]), npm/@types/[email protected]), npm/@typescript-eslint/[email protected]), npm/@typescript-eslint/[email protected]), npm/[email protected]), npm/[email protected]), npm/[email protected])

View full report↗︎

Copy link

socket-security bot commented Aug 23, 2024

👍 Dependency issues cleared. Learn more about Socket for GitHub ↗︎

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

Ignoring: npm/[email protected], npm/[email protected]

View full report↗︎

Next steps

Take a deeper look at the dependency

Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev.

Remove the package

If you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency.

Mark a package as acceptable risk

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of ecosystem/package-name@version specifiers. e.g. @SocketSecurity ignore npm/[email protected] or ignore all packages with @SocketSecurity ignore-all

@samchon
Copy link
Owner Author

samchon commented Aug 23, 2024

@SocketSecurity ignore npm/[email protected]

@SocketSecurity ignore npm/[email protected]

@ryoppippi
Copy link
Contributor

ryoppippi commented Aug 23, 2024

@samchon
Thank you for your work!

I think this approach works well. so using static property is fine!

However, I'd like to suggest to use " types" as a property instead of __types .
Using this technique, " types" will no longer appear as a candidate for auto-completion, and it is more developer friendly!
Screenshot 2024-08-23 at 10 40 10
https://www.typescriptlang.org/play/?#code/C4TwDgpgBAKlC8UDeAoK6oEsAmB+AXFAM7ABOmAdgOYDcaGARFKJEQwVBQK4C2ARhFJ0AvihQBjAPYUSUAG6E4iJMLoo5AOiA

@ryoppippi
Copy link
Contributor

Also I didn't know that this enhancement is requested before lol #760

@samchon
Copy link
Owner Author

samchon commented Aug 23, 2024

@ryoppippi Looking at your library, I think you need an LLM function calling schema generator.

I made similar one (https://github.com/wrtnio/openai-function-schema) converting from OpenAPI document to LLM function calling schema, but what you need seems like not conversion from the Restful API's OpenAPI document, but just by the TypeScript function directly.

How about suggesting a feature like below? Also, returned schema from typia.llm.functions<Functions>() or typia.llm.application<ClassType>() would better to contain the function call executor. Of course, it would much better when the executor contains the parameter separator/unifier of both Human and LLM sides. Referencing the https://github.com/wrtnio/openai-function-schema repository document and knowhows what you've experiened in the field, suggest me a graceful interfaces please.

For reference, below namespace and function name is just example. Just naming by your rule.

  • typia.llm.schemas<Types>()
  • typia.llm.functions<Functions>()
  • typia.llm.application<ClassType>()

@ryoppippi
Copy link
Contributor

ryoppippi commented Aug 23, 2024

@samchon
Thank you for your suggestion.
idk it is the right that typia includes LLM (more specifically OpenAI) spec, because typia is a library for "general purpose".

I agree that it is good if we have that kind of function, but those functions should be in separate package (like @typia/llm ?) in my opinion. and if we create the new library, I'm happy to transfer implementations in my library to the new library

@samchon
Copy link
Owner Author

samchon commented Aug 23, 2024

OpenAPI (not OpenAI) says that they are planning to publish v4 specification that is familiar to the AI (maybe LLM function calling schema). Following the roadmap, I'll move LLM function calling schema from @wrtnio/openai-function-schema to @samchon/openapi and would refactor it to be compatible with both OpenAPI operation and independent function indicating RPC (Remote Procedure Call).

Also, typia had done too much things of non-general. typia already supports protobuf and http, and people are asking for graphql support in addition. I have been requested, so that have developed everything that can be done with types. Therefore, I sometimes think that typia's slogan should be changed; not validator but type framework?

Anyway, don't mind of it about the LLM function calling schemas composition. If you and I need, just do it.

As I've developed nestia which can effectively generate Swagger Document with pure TypeScript type, I just thought about LLM function calling schema transformation only by OpenAPI document, but your case seems enough reasonable and I've missed it. If there're some developers who want to perform LLM function call execution not by external Restful API, but by their programs' internal functions, your feature would be helpful.

I think that such internal function's LLM calling can be a killer use-case of unplugin-typia.

@ryoppippi
Copy link
Contributor

ryoppippi commented Aug 23, 2024

@samchon

type framework

I like it! This is a good expression for typia. typia is not a minimal library, but FW. Sounds exciting.

I'll move LLM function calling schema from @wrtnio/openai-function-schema to @samchon/openapi

Got it.

So do you merge this PR, or dealing this issue with other library?

Also, |'m just curious why you use @samchon/openapi instead of @typia/openapi (just curious). If you think this is a FW, you can use the name of typia more(and maybe crating typia GH org is a good choice)

@samchon
Copy link
Owner Author

samchon commented Aug 23, 2024

Accept this PR, but also needs the new feature. Wait for your suggestion.

Also, no special reason for package naming.

@samchon samchon merged commit c82cbac into master Aug 23, 2024
11 checks passed
@ryoppippi
Copy link
Contributor

ryoppippi commented Aug 23, 2024

@samchon Thanks! OK got it!

Thank you as always.

@samchon samchon deleted the feature/json-schema branch August 23, 2024 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants