Follow-up from PR #1105 review thread.
In custom protocol code (e.g. src/Custom/Evals/EvaluationClient.Protocol.cs), ProcessMessage/ProcessMessageAsync is invoked with an explicit client type parameter:
return ClientResult.FromResponse(Pipeline.ProcessMessage<EvaluationClient>(message, options));
This routes error deserialization to the more specific DeserializeInternal<Foo>ErrorResponse for that client, yielding better-typed error responses. Generated methods, however, call ProcessMessage without the client type argument, so they don't benefit from the specialized error model.
Investigate
- Whether the TypeSpec/ClientModel generator should emit
ProcessMessage<TClient>/ProcessMessageAsync<TClient> calls by default.
- Trade-offs: consistency of error model deserialization across all operations vs. any perf/size costs or generator complexity.
- Whether current manually-authored usages (Evals and any others) should be unified with generator output, or if the custom pattern should continue to be used selectively.
Context
Follow-up from PR #1105 review thread.
In custom protocol code (e.g.
src/Custom/Evals/EvaluationClient.Protocol.cs),ProcessMessage/ProcessMessageAsyncis invoked with an explicit client type parameter:This routes error deserialization to the more specific
DeserializeInternal<Foo>ErrorResponsefor that client, yielding better-typed error responses. Generated methods, however, callProcessMessagewithout the client type argument, so they don't benefit from the specialized error model.Investigate
ProcessMessage<TClient>/ProcessMessageAsync<TClient>calls by default.Context