Telegram Group & Telegram Channel
Screencast from 2024-08-25 19-08-56.webm
10.3 MB
🤖 ChatGPT и Claude AI в API могут запускать функции (functions) или инструменты (tools), которые находятся на сервере клиента. Если LLM считает, что нужно выполнить такую функцию, она передает команду серверу с аргументами для выполнения.

📖 Подробнее можно почитать здесь:
- OpenAI
- Claude

🖥 Вот пример, как функция выглядит для LLM:
{
"name": "get_weather",
"description": "Determine weather in my location",
"strict": true,
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state e.g. San Francisco, CA"
},
"unit": {
"type": "string",
"enum": [
"c",
"f"
]
}
},
"additionalProperties": false,
"required": [
"location",
"unit"
]
}
}


А вот пример того, что видит сервер, когда его просят запустить функцию:

"tool_calls": [
{
"id": "call_fwTWdctuKEO9Ytf",
"name": "get_weather",
"arguments": "{\"location\":\"Moscow\",\"unit\":\"c\"}"
}
]


Сервер запускает функцию и возвращает результат. Причем в любом виде. Далее LLM уже сама придумает что с этим делать.

{
"id": "call_fwTWdctuKEO9Ytf",
"role": "tool",
"content": [
"{\"temp\":\"30\"}"
]
}


А теперь редставьте, что у вас умный дом, и вы говорите: "Включи чайник, я хочу пить". Описываем функции, которые помогут LLM посмотреть что у нас есть в квартире и управлять устройствами:

{
"key": "list_room_devices",
"description": "Lists all smart devices in a specified room.",
"input_schema": {
"type": "object",
"properties": {
"room_name": {
"type": "string",
"description": "The name of the room to query"
}
},
"required": ["room_name"]
}
}


{
"key": "control_device",
"description": "Controls a specific device by performing the specified action with given parameters.",
"input_schema": {
"type": "object",
"properties": {
"deviceId": {
"type": "string",
"description": "The unique identifier of the device to control"
},
"action": {
"type": "string",
"description": "The action to perform on the device (e.g., turnOn, turnOff, setBrightness)"
},
...
},
"required": ["deviceId", "action"]
}
}


Что сделает LLM? Она проанализирует ваш запрос, найдет подходящие функции, получит список устройств на кухне (ведь обычно чайник там), и выполнит нужное действие (включит чайник).

Круто, да? А теперь представьте PHP-фреймворк, который позволит описывать такие процессы (flow) и возьмет на себя сложные задачи, такие как запуск функций, группировку функций по назначению.

P.S. После прочтения, можно пересмотреть видео заново. В этом видео агент для управления умным домом, в котором 4 комнаты и куча устройств. Управление текстом или голосом (с переводом в текст)

#llm #ai #chatgpt #claude #php
Please open Telegram to view this post
VIEW IN TELEGRAM
4🔥153🤮1



tg-me.com/php_fart/103
Create:
Last Update:

🤖 ChatGPT и Claude AI в API могут запускать функции (functions) или инструменты (tools), которые находятся на сервере клиента. Если LLM считает, что нужно выполнить такую функцию, она передает команду серверу с аргументами для выполнения.

📖 Подробнее можно почитать здесь:
- OpenAI
- Claude

🖥 Вот пример, как функция выглядит для LLM:

{
"name": "get_weather",
"description": "Determine weather in my location",
"strict": true,
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state e.g. San Francisco, CA"
},
"unit": {
"type": "string",
"enum": [
"c",
"f"
]
}
},
"additionalProperties": false,
"required": [
"location",
"unit"
]
}
}


А вот пример того, что видит сервер, когда его просят запустить функцию:

"tool_calls": [
{
"id": "call_fwTWdctuKEO9Ytf",
"name": "get_weather",
"arguments": "{\"location\":\"Moscow\",\"unit\":\"c\"}"
}
]


Сервер запускает функцию и возвращает результат. Причем в любом виде. Далее LLM уже сама придумает что с этим делать.

{
"id": "call_fwTWdctuKEO9Ytf",
"role": "tool",
"content": [
"{\"temp\":\"30\"}"
]
}


А теперь редставьте, что у вас умный дом, и вы говорите: "Включи чайник, я хочу пить". Описываем функции, которые помогут LLM посмотреть что у нас есть в квартире и управлять устройствами:

{
"key": "list_room_devices",
"description": "Lists all smart devices in a specified room.",
"input_schema": {
"type": "object",
"properties": {
"room_name": {
"type": "string",
"description": "The name of the room to query"
}
},
"required": ["room_name"]
}
}


{
"key": "control_device",
"description": "Controls a specific device by performing the specified action with given parameters.",
"input_schema": {
"type": "object",
"properties": {
"deviceId": {
"type": "string",
"description": "The unique identifier of the device to control"
},
"action": {
"type": "string",
"description": "The action to perform on the device (e.g., turnOn, turnOff, setBrightness)"
},
...
},
"required": ["deviceId", "action"]
}
}


Что сделает LLM? Она проанализирует ваш запрос, найдет подходящие функции, получит список устройств на кухне (ведь обычно чайник там), и выполнит нужное действие (включит чайник).

Круто, да? А теперь представьте PHP-фреймворк, который позволит описывать такие процессы (flow) и возьмет на себя сложные задачи, такие как запуск функций, группировку функций по назначению.

P.S. После прочтения, можно пересмотреть видео заново. В этом видео агент для управления умным домом, в котором 4 комнаты и куча устройств. Управление текстом или голосом (с переводом в текст)

#llm #ai #chatgpt #claude #php

BY PHP Fart Time


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/php_fart/103

View MORE
Open in Telegram


PHP Fart Time Telegram | DID YOU KNOW?

Date: |

The Singapore stock market has alternated between positive and negative finishes through the last five trading days since the end of the two-day winning streak in which it had added more than a dozen points or 0.4 percent. The Straits Times Index now sits just above the 3,060-point plateau and it's likely to see a narrow trading range on Monday.

Export WhatsApp stickers to Telegram on iPhone

You can’t. What you can do, though, is use WhatsApp’s and Telegram’s web platforms to transfer stickers. It’s easy, but might take a while.Open WhatsApp in your browser, find a sticker you like in a chat, and right-click on it to save it as an image. The file won’t be a picture, though—it’s a webpage and will have a .webp extension. Don’t be scared, this is the way. Repeat this step to save as many stickers as you want.Then, open Telegram in your browser and go into your Saved messages chat. Just as you’d share a file with a friend, click the Share file button on the bottom left of the chat window (it looks like a dog-eared paper), and select the .webp files you downloaded. Click Open and you’ll see your stickers in your Saved messages chat. This is now your sticker depository. To use them, forward them as you would a message from one chat to the other: by clicking or long-pressing on the sticker, and then choosing Forward.

PHP Fart Time from us


Telegram PHP Fart Time
FROM USA