-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Request from iHub - we need to be able to reliably provide higher-level information for both humans and LLMs to be able to pick an endpoint to use.
Simple types will often not provide enough information in the schema by default, the SDK should correct this
In this example:
@intersect_message
def my_endpoint(self, temperature: int) -> int:
...the generated schema for both input and output would simply look like this:
{
"type": "integer"
}The python code is valid and it should be supported for domain scientists to use this syntax. The high-level output name can generally be deduced from the function name, so we need to be able to be able to generate a schema which looks like this for the input:
{
"type": "integer",
"title": "temperature"
}The ideal approach is to try to utilize Pydantic annotations to obtain this, and fall back to the parameter name if we can't get a Pydantic annotation.
NOTE
The following syntax is already supported by INTERSECT and will already work:
from typing import Annotated
from pydantic import Field
from intersect_sdk import intersect_message
def my_endpoint(self, ignored_parameter_name: Annotated[int, Field(title="temperature", description="longer description goes here")]) -> int:
...This is the preferred way of defining "simple" endpoints for schema (and is necessary to add validation support), but we still want to provide support for the more straightforward way of writing Python functions.