-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
realtime
specific entry point + Java emitter config
#325
base: main
Are you sure you want to change the base?
Conversation
@trrwilson , it would be great to be able to merge this if we are able to move forward with the dev feed release of the Java client library (Azure/azure-sdk-for-java#42707). Let me know if this needs updating in anyway so that it works well with the other emitters being used. Thank you! |
.typespec/realtime/client.tsp
Outdated
}) | ||
@server("wss://api.openai.com/v1", "OpenAI Endpoint") | ||
@useAuth(BearerAuth) | ||
namespace OpenAI; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think converting this client.tsp into a main.tsp is a little confusing.
Would it work if we did the following?
- Create a separate folder under the ".typespec" folder called ".java", where we put this file (but call it "main.tsp") and also the "tspconfig.yaml" file.
- Rename the "dotnet.tsp" and "java.tsp" files to "client.dotnet.tsp" and "client.java.tsp".
- Move the "client.dotnet.tsp" and "client.java.tsp" files under ".typespec/realtime" instead of ".typespec/realtime/custom".
- Revert the changes to the "/.typespec/realtime/main.tsp", but edit it to import both the "client.dotnet.tsp" file and "client.java.tsp" file.
- Revert the changes to the "custom.tsp" file, and move it under the "custom" folder with the rest of the custom models.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for all the feedback! Agreed in all accounts. Just regarding point 1 and after discussing with @trrwilson, I think that instead of having a cut "per language" we might actually prefer to have a cut "per artifact" we are hoping to generate from the spec.
I will go ahead and create a separate folder where we can start defining entry points as we need them. For now, we generally need:
- Catch all entry point (for .NET and OpenAPIv3)
- Realtime specific (Java)
- Other entry points we might need in the future, but is highly dependent on how we move forward with the companion libraries to the stainless ones: batch, inference, assistants, etc.
Let me know what you think about this approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding moving custom.tsp
, I didn't really do anything other than adding a couple of imports and removing an unused import which was breaking code gen in the java repo. Would it be okay to omit this change in this PR, as I would like to focus on the multiple entry point part of it and the Java support for realtime instead?
More than happy to follow up in a different PR with any restructuring that may be needed.
8b35c3f
to
c26e90a
Compare
What's this?
A custom entry point to allow code gen for
realtime
specifically by having atsp-location.yaml
that looks like this:Learnings
While testing how to best approach this, I have learn the following about the tsp-client behaviour, which is what I understand is the recommended way of generating code in the SDK repositories. (I will be using
realtime
as the example)directory: .typespec.entry_points/realtime
as a target folder, when runningtsp-client sync
to populate theTempTypeSpecFiles
folder, we will only get the contents of the folder itself, but not the actual TSP definition found in the../.typespec
directory. (This might be obvious enough, even though we are importing other files, I don't think that the tooling has a concept of a project tree to build)additionalDirectories: .typespec/realtime
(just to scope the pulling of files to what we strictly need). The result of this step was unexpected. Files underdirectory
andadditionalDirectories
are flattened underTempTypeSpecFiles
which breaks any folder structure in the source repository.import
statements in the.typespec.entry_point/*/main.tsp
files to be completely meaningless, since these will be flattened with anything coming in from theadditionalDirectories
..typespec.entry_points
at the same level of.azure.typespec
and.typespec
is because we will (do) have entry points for both folders, so hierarchically speaking, it makes sense.How to move forward
There are a few possibilities:
Approach 1: feature requesting the tooling to change behaviour
directory
andadditionalDirectories
behaviour, try to find out why it is the way it is and whether this is behaving according to some agreed spec that would be hard to change. This approach in all likelihood won't get us very far, that behaviour is probably by now, a well established assumption taken into account by many developers at this point. Pros and cons:Approach 2: root folder entry points + jive with folder flattening
.typespec/realtime
I removedclient.tsp
..typespec.entry_points/realtime
I have added aclient.tsp
.typespec.entry_points/realtime/client.tsp
to assume thatmain.tsp
is in the same folderclient.tsp
filename has become vetoed and a reserved name for bootstraping entry points to services.client.tsp
files import statements invalid.Approach 3: Avoid folder flattening behaviour + duplication
.typespec.entry_points
into.typespec
and.azure.typespec
.azure.typespec
and.typespec
scenarios.Remaining TODOs
.typespec/realtime/client.tsp
. Now it's all dumped in its correspondingmain.tsp
file.