Slide 21
Slide 21 text
§ Tool / function calling standard
established by OpenAI
§ Functions for interactions
§ LLM chooses to output JSON object
containing arguments to call one or
many functions
§ LLM does not call the function
§ You do it in your code
§ All major libs support
tool calling with abstractions
§ OpenAI SDKs
§ Langchain
§ Semantic Kernel
AI++: Integration von Large Language Models (LLMs) in moderne Business-Software
Sprachverständnis ändert alles
Extending LLM capabilities
21
curl https://api.openai.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "gpt-3.5-turbo",
"messages": [
{
"role": "user",
"content": "What is the weather like in Boston?"
}
],
"tools": [
{
"type": "function",
"function": {
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
},
"unit": {
"type": "string",
"enum": ["celsius", "fahrenheit"]
}
},
"required": ["location"]
}
}
}
],
"tool_choice": "auto"
}'