Telegram Group & Telegram Channel
Какой из промптов будет давать более точный ответ?

Промпты почти одинаковые, меняется только порядок.


from openai import OpenAI
client = OpenAI()

prompt1 = f"How many times is word 'RAG' mentioned in the text? Answer with a number.\n<text>{text}</text>"
prompt2 = f"<text>{text}</text>\nHow many times is word 'RAG' mentioned in the text? Answer with a number."

for p in [prompt1, prompt2]:
completion = client.chat.completions.create(
temperature=0,
model="gpt-4o-2024-11-20",
messages=[
{"role": "user", "content":p}
]
)
print(completion.choices[0].message.content)


Сможете ответить сходу и объяснить почему?

Если сложно сказать, попробуйте запустить код несколько раз и убедиться сами. Абзац текста я добавлю в комментарии.

Второй вопрос - а какой из промптов будет давать более точный ответ в случае использования Structured Output и почему? 😜


class Response(BaseModel):
how_many_times_is_word_RAG_mentioned_in_text: int

for p in [prompt1, prompt2]:
completion = client.beta.chat.completions.parse(
model="gpt-4o-2024-11-20",
temperature=0,
response_format=Response,
messages=[
{"role": "user", "content": p}
]
)

print(completion.choices[0].message.parsed)



Ваш, @llm_under_hood 🤗


PS: Это новая задачка, которую я решил добавить в практическую часть курса для выработки интуиции. Уж больно она наглядная и неожиданная.
🔥51👍238🤔3



tg-me.com/llm_under_hood/489
Create:
Last Update:

Какой из промптов будет давать более точный ответ?

Промпты почти одинаковые, меняется только порядок.


from openai import OpenAI
client = OpenAI()

prompt1 = f"How many times is word 'RAG' mentioned in the text? Answer with a number.\n<text>{text}</text>"
prompt2 = f"<text>{text}</text>\nHow many times is word 'RAG' mentioned in the text? Answer with a number."

for p in [prompt1, prompt2]:
completion = client.chat.completions.create(
temperature=0,
model="gpt-4o-2024-11-20",
messages=[
{"role": "user", "content":p}
]
)
print(completion.choices[0].message.content)


Сможете ответить сходу и объяснить почему?

Если сложно сказать, попробуйте запустить код несколько раз и убедиться сами. Абзац текста я добавлю в комментарии.

Второй вопрос - а какой из промптов будет давать более точный ответ в случае использования Structured Output и почему? 😜


class Response(BaseModel):
how_many_times_is_word_RAG_mentioned_in_text: int

for p in [prompt1, prompt2]:
completion = client.beta.chat.completions.parse(
model="gpt-4o-2024-11-20",
temperature=0,
response_format=Response,
messages=[
{"role": "user", "content": p}
]
)

print(completion.choices[0].message.parsed)



Ваш, @llm_under_hood 🤗


PS: Это новая задачка, которую я решил добавить в практическую часть курса для выработки интуиции. Уж больно она наглядная и неожиданная.

BY LLM под капотом


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

Share with your friend now:
tg-me.com/llm_under_hood/489

View MORE
Open in Telegram


telegram Telegram | DID YOU KNOW?

Date: |

Can I mute a Telegram group?

In recent times, Telegram has gained a lot of popularity because of the controversy over WhatsApp’s new privacy policy. In January 2021, Telegram was the most downloaded app worldwide and crossed 500 million monthly active users. And with so many active users on the app, people might get messages in bulk from a group or a channel that can be a little irritating. So to get rid of the same, you can mute groups, chats, and channels on Telegram just like WhatsApp. You can mute notifications for one hour, eight hours, or two days, or you can disable notifications forever.

Traders also expressed uncertainty about the situation with China Evergrande, as the indebted property company has not provided clarification about a key interest payment.In economic news, the Commerce Department reported an unexpected increase in U.S. new home sales in August.Crude oil prices climbed Friday and front-month WTI oil futures contracts saw gains for a fifth straight week amid tighter supplies. West Texas Intermediate Crude oil futures for November rose $0.68 or 0.9 percent at 73.98 a barrel. WTI Crude futures gained 2.8 percent for the week.

telegram from us


Telegram LLM под капотом
FROM USA