Skip to content

Conversation

prwhelan
Copy link
Member

@prwhelan prwhelan commented Feb 5, 2025

When we are already parsing events, we can receive errors as the next event.

OpenAI formats these as:

event: error
data: <payload>

Elastic formats these as:

data: <payload>

Unified will consolidate them into the new error structure.

When we are already parsing events, we can receive errors as the next
event.

OpenAI formats these as:
```
event: error
data: <payload>
```

Elastic formats these as:
```
data: <payload>
```

Unified will consolidate them into the new error structure.
@prwhelan prwhelan added >bug :ml Machine learning Team:ML Meta label for the ML team auto-backport Automatically create backport pull requests when merged v9.0.0 v8.18.0 labels Feb 5, 2025
@elasticsearchmachine
Copy link
Collaborator

Hi @prwhelan, I've created a changelog YAML for you.

@prwhelan prwhelan marked this pull request as ready for review February 5, 2025 20:30
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/ml-core (Team:ML)

}

private static Exception buildMidStreamError(Request request, String message, Exception e) {
var restStatus = RestStatus.OK;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be the same as the EIS one?

var results = new ArrayDeque<StreamingUnifiedChatCompletionResults.ChatCompletionChunk>(item.size());
for (var event : item) {
if (ServerSentEventField.EVENT == event.name() && "error".equals(event.value())) {
previousEventWasNotError = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: This might be a bit easier to read using the positive form previousEventWasAnError = true.

Then in the check below we could do:

if (previousEventWasAnError) {
  throw errorParser.apply(event.value(), null);
}

try {

} catch () {

}

Copy link
Contributor

@jonathan-buttner jonathan-buttner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes!

@prwhelan prwhelan enabled auto-merge (squash) February 6, 2025 20:15
@prwhelan prwhelan merged commit c38ea53 into elastic:main Feb 6, 2025
17 checks passed
prwhelan added a commit to prwhelan/elasticsearch that referenced this pull request Feb 6, 2025
When we are already parsing events, we can receive errors as the next
event.

OpenAI formats these as:
```
event: error
data: <payload>
```

Elastic formats these as:
```
data: <payload>
```

Unified will consolidate them into the new error structure.
prwhelan added a commit to prwhelan/elasticsearch that referenced this pull request Feb 6, 2025
When we are already parsing events, we can receive errors as the next
event.

OpenAI formats these as:
```
event: error
data: <payload>
```

Elastic formats these as:
```
data: <payload>
```

Unified will consolidate them into the new error structure.
prwhelan added a commit to prwhelan/elasticsearch that referenced this pull request Feb 6, 2025
When we are already parsing events, we can receive errors as the next
event.

OpenAI formats these as:
```
event: error
data: <payload>
```

Elastic formats these as:
```
data: <payload>
```

Unified will consolidate them into the new error structure.
@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
9.0
8.18
8.x

elasticsearchmachine pushed a commit that referenced this pull request Feb 6, 2025
When we are already parsing events, we can receive errors as the next
event.

OpenAI formats these as:
```
event: error
data: <payload>
```

Elastic formats these as:
```
data: <payload>
```

Unified will consolidate them into the new error structure.
elasticsearchmachine pushed a commit that referenced this pull request Feb 7, 2025
When we are already parsing events, we can receive errors as the next
event.

OpenAI formats these as:
```
event: error
data: <payload>
```

Elastic formats these as:
```
data: <payload>
```

Unified will consolidate them into the new error structure.
prwhelan added a commit that referenced this pull request Feb 7, 2025
When we are already parsing events, we can receive errors as the next
event.

OpenAI formats these as:
```
event: error
data: <payload>
```

Elastic formats these as:
```
data: <payload>
```

Unified will consolidate them into the new error structure.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-backport Automatically create backport pull requests when merged :ml Machine learning >non-issue Team:ML Meta label for the ML team v8.18.0 v8.18.1 v8.19.0 v9.0.0 v9.0.1 v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants