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


LLM под капотом Telegram | DID YOU KNOW?

Date: |

What is Secret Chats of Telegram

Secret Chats are one of the service’s additional security features; it allows messages to be sent with client-to-client encryption. This setup means that, unlike regular messages, these secret messages can only be accessed from the device’s that initiated and accepted the chat. Additionally, Telegram notes that secret chats leave no trace on the company’s services and offer a self-destruct timer.

Unlimited members in Telegram group now

Telegram has made it easier for its users to communicate, as it has introduced a feature that allows more than 200,000 users in a group chat. However, if the users in a group chat move past 200,000, it changes into "Broadcast Group", but the feature comes with a restriction. Groups with close to 200k members can be converted to a Broadcast Group that allows unlimited members. Only admins can post in Broadcast Groups, but everyone can read along and participate in group Voice Chats," Telegram added.

LLM под капотом from us


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