static Dictionary GetParameterDefinition()

in src/WebJobs.Extensions.OpenAI/Assistants/IAssistantSkillInvoker.cs [99:140]


    static Dictionary<string, object> GetParameterDefinition(Skill skill)
    {
        // Try to infer from the .NET parameter type (only works with in-proc WebJobs)
        string type;
        switch (skill.Parameter.ParameterType)
        {
            case Type t when t == typeof(string):
                type = "string";
                break;
            case Type t when t == typeof(int):
                type = "integer";
                break;
            case Type t when t == typeof(bool):
                type = "boolean";
                break;
            case Type t when t == typeof(float):
                type = "number";
                break;
            case Type t when t == typeof(double):
                type = "number";
                break;
            case Type t when t == typeof(decimal):
                type = "number";
                break;
            case Type _ when typeof(System.Collections.IEnumerable).IsAssignableFrom(skill.Parameter.ParameterType):
                type = "array";
                break;
            default:
                type = "string";
                break;
        }

        // Schema reference: https://platform.openai.com/docs/api-reference/chat/create#chat-create-tools
        return new Dictionary<string, object>
        {
            ["type"] = "object",
            ["properties"] = new Dictionary<string, object>
            {
                [skill.Parameter.Name] = new { type }
            }
        };
    }