Я пытался заставить LLM помочь с проверкой кода, но у меня ничего не получилось.
Я хочу, чтобы LLM мог обнаруживать потенциальные ошибки в коде или даже давать предложение по оптимизации.
Ни один из протестированных мною LLM не смог решить довольно простой случай (gpt-4, o1, claude, qwen…)
Вот пример кода на PHP:
echo $data->status?->id == 4 ? "member1" : "non-member1";
echo !empty($data->status->id) && $data->status->id == 5 ? "member2" : "non-member2";
tldr: LLM должна сказать мне, что второй образец безопаснее, но он делает обратное
Я пробовал:
< pre class="lang-markdown Prettyprint-override"># first attempt
what is the difference between these code samples?
first sample: {{sample1}}
seconde sample: {{sample2}}
# first response (which is false btw)
The first sample is safer as it handles the case where $data->status might be null.
The second sample does not handle the case where $data->status might be null and will throw an error in such a scenario.
# my reply (then LLM agrees)
it seems you are wrong about the second sample, you said "Throws error if $data->status is null."
but the function 'empty' of PHP also check if the data is set, right?
# second attempt
I have these code samples.
define the concept and functions used.
give me the difference between the samples.
first sample: {{sample1}}
seconde sample: {{sample2}}
# response is more elaborate but in summary same wrong response as before
Подробнее здесь: https://stackoverflow.com/questions/792 ... ode-review
Как сделать LLM более точным при проверке кода? ⇐ Php
Кемеровские программисты php общаются здесь
-
Anonymous
1731998565
Anonymous
Я пытался заставить LLM помочь с проверкой кода, но у меня ничего не получилось.
Я хочу, чтобы LLM мог обнаруживать потенциальные ошибки в коде или даже давать предложение по оптимизации.
Ни один из протестированных мною LLM не смог решить довольно простой случай (gpt-4, o1, claude, qwen…)
Вот пример кода на PHP:
echo $data->status?->id == 4 ? "member1" : "non-member1";
echo !empty($data->status->id) && $data->status->id == 5 ? "member2" : "non-member2";
tldr: LLM должна сказать мне, что второй образец безопаснее, но он делает обратное
Я пробовал:
< pre class="lang-markdown Prettyprint-override"># first attempt
what is the difference between these code samples?
first sample: {{sample1}}
seconde sample: {{sample2}}
# first response (which is false btw)
The first sample is safer as it handles the case where $data->status might be null.
The second sample does not handle the case where $data->status might be null and will throw an error in such a scenario.
# my reply (then LLM agrees)
it seems you are wrong about the second sample, you said "Throws error if $data->status is null."
but the function 'empty' of PHP also check if the data is set, right?
# second attempt
I have these code samples.
define the concept and functions used.
give me the difference between the samples.
first sample: {{sample1}}
seconde sample: {{sample2}}
# response is more elaborate but in summary same wrong response as before
Подробнее здесь: [url]https://stackoverflow.com/questions/79202326/how-to-make-llm-more-accurate-in-code-review[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия