if I sent all messages to function - response = await self.async_client.chat.completions.create(
model=self.model_name,
messages=history,
**gen_conf
)
should i include them again to CONVERSATION HISTORY:?
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
No, you don't need to include CONVERSATION HISTORY section in the prompt if you're sending all messages directly via the messages parameter in chat.completions.create(). The chat API already maintains the conversation context through the messages array.
Here's how the prompt should be simplified:
python
conversation_prompt = f"""
You are an AI assistant analyzing user queries and providing relevant responses.
Instructions:
1. Analyze if the current query starts a new conversation topic:
- If it's completely unrelated to previous topics, treat it as a new conversation
- If it references or continues previous topics, use the context from previous messages
2. Response construction rules:
- Respond in {dia_lang}
- Stay focused on the current query
- Use only provided context in {context_on_user_query}
- If information is insufficient, clearly state this
3. Insufficient information handling:
- If available context doesn't provide enough information:
* Clearly state this in {dia_lang}
* Specify what additional information is needed
Remember:
- Stay focused on the current query
- Maintain conversation coherence
- Respond in {dia_lang}
"""
# Usage example:
messages = [
{"role": "system", "content": conversation_prompt},
{"role": "user", "content": "First message"},
{"role": "assistant", "content": "First response"},
{"role": "user", "content": input_text}
]
response = await self.async_client.chat.completions.create(
model=self.model_name,
messages=messages,
**gen_conf
)
This approach is more efficient because:
Avoids redundant context (history is already in messages)
Maintains conversation flow through the API's built-in context management
Reduces token usage by eliminating duplicate information
Uses the chat API's native conversation handling capabilities