interfAIce icon indicating copy to clipboard operation
interfAIce copied to clipboard

Support Function calling

Open mscheong01 opened this issue 2 years ago • 1 comments

OpenAI has added "function calling" feature to the Chat api https://openai.com/blog/function-calling-and-other-api-updates

We could leverage this feature to allow interfAIce proxies to call upon other methods ex)

interface FunctionAware<T> {
    fun withFunction( ... ): T
    fun withFunctions( ... ): T
}
interface WeatherService : FunctionAware<WeatherService> {
    fun getWeather(): Weather
}
val proxy = OpenAiProxyFactory.of("sk-****").create<WeatherService>()
proxy
    .withFunction(weatherClient::greet)
    .getWeather()

mscheong01 avatar Jun 14 '23 04:06 mscheong01

https://github.com/openai/openai-cookbook/blob/main/examples/How_to_call_functions_with_chat_models.ipynb

mscheong01 avatar Jun 14 '23 04:06 mscheong01