Skip to content

TokenLimitedChatCompletionContext removes elements from the middle, which may cause errors in certain situations. Should it remove elements from the beginning of the list rather than from the middle? #6789

Open
@bbbaka

Description

@bbbaka

What happened?

Describe the bug
A clear and concise description of what the bug is.
If it is a question or suggestion, please use Discussions
instead.

To Reproduce
Steps to reproduce the behavior. Please include code and outputs such as stacktrace.

  • If your input is just "I tried X, and it didn't work" or
    "X is not working", your issue will be ignored.
  • If your input is not well formatted, it will hurt readability and
    may be ignored as well.

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Image

openai.BadRequestError: Error code: 400 - {'success': False, 'message': '模型提供方错误', 'data': None, 'code': 'MPE-001', 'detailMessage': '{"error": {"type": "llm_call_failed", "message": "{\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.68.content.1: unexpected tool_use_id found in tool_result blocks: toolu_vrtx_01MCPRK1tTKWRkHW3SxMFGKL. Each tool_result block must have a corresponding tool_use block in the previous message.\"}}\n", "treace_id": "213e006d17521499690678426e11b4"}}, traceId: 213e006d17521499690678426e11b4'}

Which packages was the bug in?

Python Core (autogen-core)

AutoGen library version.

Python 0.6.4

Other library version.

No response

Model used

No response

Model provider

None

Other model provider

No response

Python version

None

.NET version

None

Operating system

None

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions