Factor Responses into its own assembly#889
Conversation
jsquire
left a comment
There was a problem hiding this comment.
I've got a PR out to move the repository configuration and package management to a centralized version, which would remove a lot of the redundancies that you needed in the project files and such.
eb86e8b to
c6532a5
Compare
| @@ -84,11 +85,30 @@ if ($LASTEXITCODE -ne 0) { | |||
| exit $LASTEXITCODE | |||
There was a problem hiding this comment.
nit: Edit the error message to something like "GenAPI failed for OpenAI with exit code $LASTEXITCODE" to differentiate it from failing for OpenAI.Responses.
| if ($LASTEXITCODE -ne 0) { | ||
| Write-Error "GenAPI failed for OpenAI.Responses with exit code $LASTEXITCODE" | ||
| exit $LASTEXITCODE | ||
| } |
There was a problem hiding this comment.
I see that the API listings for OpenAI still contain all the stuff from OpenAI.Responses, and I wonder if it would be preferable to not modify this script. I'm thinking it might be better to not produce individual API listings for Responses for a few reasons:
- It feels redundant.
- It sets the precedent of having to modify this script every time we split a library out of the base library.
- It adds at least some latency to this script (which is already a little slow).
In general, if our infra can continue to work without modifications, I think that would be ideal. I'm thinking of this script, but I'm also thinking of other validation scripts (Test-ApiCompatibility.ps1, Test-AotCompatibility.ps1, etc.), as well as our pipelines.
There was a problem hiding this comment.
I think as we have new assemblies it's important to understand if there are any differences between what shows up in the main assembly and what shows up in the sub-assembly. I think it will always be true that the main assembly will contain everything, but it's not always clear what subset would be available in the subassembly.
| @@ -0,0 +1,57 @@ | |||
| <Project Sdk="Microsoft.NET.Sdk"> | |||
There was a problem hiding this comment.
Are there benefits to splitting the OpenAI.Tests project too, or is it reasonable to keep it unchanged? If keeping one single project works fine, I would strongly prefer that for simplicity. Otherwise, I worry that this will be difficult to scale and impact our productivity.
There was a problem hiding this comment.
This is to validate that tests still pass when loading just the subassembly and not the main assembly.
There was a problem hiding this comment.
I agree that this is valuable. Can we think of an alternative that allows us to get this benefit in some way that does not require maintaining separate projects and separate test infrastructure for each new library that we onboard? I'm a little worried because I'm envisioning a nearby future where we have over a dozen libraries, and the cost of standing up test infra for each, along with modifying pipelines, scripts, etc. and then maintaining all of it will hinder us.
I'm thinking about it in the following way: Because the OpenAI library is by design just a passthrough for the OpenAI.Responses library, testing OpenAI.Responses through OpenAI is a valid way of testing its functionality. Then, the question changes from "does this work at all?" to "can we validate that this is all actually coming from OpenAI.Responses?". The funny part is that because all the functionality related to the Responses API must be in OpenAI.Responses and we must not put any of it in OpenAI by design, the answer is technically an automatic "yes" by definition. So while I agree that this validation would be good to have to ensure that we don't accidentally break our design somehow, it also feels a little superfluous and makes the trade-off in complexity a bit of a hard pill to swallow. 😕
What could be considered a "good enough" way to validate that the functionality is actually coming from OpenAI.Responses? I'm even considering something like the following: "What if we had a job in our nightly pipeline that checks out main, deletes everything in the test project except Responses, swaps the dependency from OpenAI to OpenAI.Responses, and runs the recorded tests?". While a solution like this is still something that we will need to maintain, maintaining a single pipeline job is simpler compared to multiple test projects and test infras. It would be entirely isolated in a single YAML file, and because we're delegating the validation to a pipeline, we can basically forget about it during our day-to-day work. Am I crazy? 🤔
There was a problem hiding this comment.
Let me see what I can do to improve it - worst case we can rely on just the main assembly
There was a problem hiding this comment.
Just pushed an update that refactors things a bit to minimize duplication. Let me know if this looks ok to you.
Removed extra newline before 'Using the async API' section.
…tor' into chriss/module-refactor
| [ModelReaderWriterBuildable(typeof(WebSearchToolApproximateLocation))] | ||
| [ModelReaderWriterBuildable(typeof(WebSearchToolFilters))] | ||
| [ModelReaderWriterBuildable(typeof(WebSearchToolLocation))] | ||
| public partial class ResponsesModelContext |
There was a problem hiding this comment.
This should be auto-generated.
There was a problem hiding this comment.
Are you suggesting we do this via a Visitor or something like that? We can certainly do that longer term.
|
|
||
| namespace OpenAI.Responses.Internal | ||
| { | ||
| internal partial class OpenAIError |
There was a problem hiding this comment.
Question: The name of this file says "Generated", but it's not in the Generated folder. Is this file generated or is it a custom copy of a generated file?
| /// as the specified <see cref="OpenAIClientOptions"/>. | ||
| /// </summary> | ||
| /// <returns> A new <see cref="ResponsesClientOptions"/> with the same property values. </returns> | ||
| internal ResponsesClientOptions ToResponsesClientOptionss() |
There was a problem hiding this comment.
| internal ResponsesClientOptions ToResponsesClientOptionss() | |
| internal ResponsesClientOptions ToResponsesClientOptions() |
There was a problem hiding this comment.
Should these methods move to the Responses assembly as extension methods?
No description provided.