这是indexloc提供的服务,不要输入任何密码
Skip to content

[Feat]: Hope the order of Artifact parts can be guaranteed from the underlying design. #899

@MrChengmo

Description

@MrChengmo

Is your feature request related to a problem? Please describe.

Following the guidance in the documentation, I can understand and use Artifact to send my streaming events downstream. Generally speaking, it is similar to the following three examples:

  • The first Artifact represents the package that initiates a streaming event.
{
  "append": false,
  "lastChunk": false,  
  "artifact": {
    "artifactId": "i-xxxx",
    "parts": [
      {
        "type": "text",
        "text": "<section 1>"
      }
    ]
  }
}
  • The second or Nth Artifact represents the package during the running process of a streaming event.
{
  "append": true,
  "lastChunk": false,  
  "artifact": {
    "artifactId": "i-xxxx",
    "parts": [
      {
        "type": "text",
        "text": "<section 2>"
      }
    ]
  }
}
{
  "append": true,
  "lastChunk": false,  
  "artifact": {
    "artifactId": "i-xxxx",
    "parts": [
      {
        "type": "text",
        "text": "<section 3>"
      }
    ]
  }
}
  • The last Artifact represents the package that signifies the end of a streaming event.
{
  "append": true,
  "lastChunk": true,  
  "artifact": {
    "artifactId": "i-xxxx",
    "parts": [
      {
        "type": "text",
        "text": "<rest of section End>"
      }
    ]
  }
}

The problem now lies with the intermediate packages. Due to issues such as certain forwarding services or network instability, my downstream users need to verify the order of all Artifact Parts to ensure that these products can be correctly combined, such as using TextPart to assemble the correct conversation history. However, currently, Artifact and TaskArtifactUpdateEvent lack such an auto-incrementing ID that indicates the order.

For example, there is no error - reporting mechanism for the downstream when it receives such a sequence of events.

{
  "append": true,
  "lastChunk": false,  
  "artifact": {
    "artifactId": "i-xxxx",
    "parts": [
      {
        "type": "text",
        "text": "<section 3>"
      }
    ]
  }
}
{
  "append": true,
  "lastChunk": false,  
  "artifact": {
    "artifactId": "i-xxxx",
    "parts": [
      {
        "type": "text",
        "text": "<section 2>"
      }
    ]
  }
}

Describe the solution you'd like

The solution I can currently think of, apart from ensuring the ordered sending of events at the hardware level, is to add an order_id in the TaskArtifactUpdateEvent.metadata, allowing downstream users to ensure the correct sequential assembly of Parts.

From the perspective of the underlying design of the protocol, what suggestions and solutions do you have?

Describe alternatives you've considered

No response

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions