interfAIce
interfAIce copied to clipboard
Support Function calling
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()
https://github.com/openai/openai-cookbook/blob/main/examples/How_to_call_functions_with_chat_models.ipynb