Skip to content

realtime specific entry point + Java emitter config #325

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

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .typespec.azure/chat/models.request.tsp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import "@typespec/versioning";

import "../../.typespec/chat/models.tsp";
import "../main.tsp";
// import "../main.tsp";
import "./models.oyd.auth.tsp";
import "./models.oyd.vectorization.tsp";

Expand Down
2 changes: 1 addition & 1 deletion .typespec.azure/common/models.rai.tsp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import "@typespec/versioning";
import "../main.tsp";
// import "../main.tsp";

using TypeSpec.Versioning;

Expand Down
2 changes: 1 addition & 1 deletion .typespec.azure/files/models.tsp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import "@typespec/versioning";
import "../main.tsp";
// import "../main.tsp";
import "../../.typespec/files/models.tsp";

using TypeSpec.OpenAPI;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import "@typespec/openapi3";
import "@typespec/openapi";
import "@typespec/versioning";

import "./assistants";
import "./chat";
import "./files";
import "./images";
import "./runs";
import "./messages";
import "../../.typespec.azure/assistants";
import "../../.typespec.azure/chat";
import "../../.typespec.azure/files";
import "../../.typespec.azure/images";
import "../../.typespec.azure/runs";
import "../../.typespec.azure/messages";

using TypeSpec.Http;
using TypeSpec.Versioning;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
emit:
- "@typespec/openapi3"
- "@azure-tools/typespec-csharp"
# - "@azure-tools/typespec-csharp"
options:
"@typespec/openapi3":
output-file: "{project-root}/../.openapi3.azure/openapi3-azure-openai-{version}-generated.yaml"
# {project-root} seems to be the path of where the tspconfig.yaml file is located
output-file: "{project-root}/../../.openapi3.azure/openapi3-azure-openai-{version}-generated.yaml"
"@azure-tools/typespec-csharp":
namespace: "Azure.AI.OpenAI"
emitter-output-dir: "{project-root}/../.dotnet.azure/sdk/openai/Azure.AI.OpenAI/src"
Expand Down
41 changes: 41 additions & 0 deletions .typespec.entry_points/full_openai/main.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import "@typespec/http";
import "@typespec/openapi3";
import "@typespec/openapi";

import "../../.typespec/administration";
import "../../.typespec/audio";
import "../../.typespec/assistants";
import "../../.typespec/batch";
import "../../.typespec/chat";
import "../../.typespec/completions";
import "../../.typespec/embeddings";
import "../../.typespec/files";
import "../../.typespec/fine-tuning";
import "../../.typespec/images";
import "../../.typespec/messages";
import "../../.typespec/models";
import "../../.typespec/moderations";
import "../../.typespec/realtime";
import "../../.typespec/runs";
import "../../.typespec/threads";
import "../../.typespec/vector-stores";
import "../../.typespec/uploads";

using TypeSpec.Http;

/** The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details. */
@service({
title: "OpenAI API",
termsOfService: "https://openai.com/policies/terms-of-use",
contact: {
name: "OpenAI Support",
url: "https://help.openai.com",
},
license: {
name: "MIT",
url: "https://github.com/openai/openai-openapi/blob/master/LICENSE",
},
})
@server("https://api.openai.com/v1", "OpenAI Endpoint")
@useAuth(BearerAuth)
namespace OpenAI;
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
emit:
- "@typespec/openapi3"
- "@open-ai/plugin"
# - "@open-ai/plugin"
options:
"@typespec/openapi3":
output-file: "{project-root}/../.openapi3/openapi3-openai.yaml"
# {project-root} seems to be the path of where the tspconfig.yaml file is located
output-file: "{project-root}/../../.openapi3/openapi3-openai.yaml"
"@typespec/http-client-csharp":
emitter-output-dir: "{project-root}/../.dotnet"
unreferenced-types-handling: keepAll
Expand Down
23 changes: 23 additions & 0 deletions .typespec.entry_points/realtime/client.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import "@typespec/http";

import "./main.tsp";

using TypeSpec.Http;

/** The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details. */
@service({
title: "OpenAI API",
termsOfService: "https://openai.com/policies/terms-of-use",
contact: {
name: "OpenAI Support",
url: "https://help.openai.com",
},
license: {
name: "MIT",
url: "https://github.com/openai/openai-openapi/blob/master/LICENSE",
},
})
@server("wss://api.openai.com/v1", "OpenAI Endpoint")
@useAuth(BearerAuth)
namespace OpenAI;

10 changes: 10 additions & 0 deletions .typespec.entry_points/realtime/tspconfig.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
options:
"@azure-tools/typespec-java":
package-dir: "azure-ai-openai-realtime"
namespace: "com.azure.ai.openai.realtime"
partial-update: true
enable-sync-stack: true
generate-tests: false
generate-samples: false
custom-types-subpackage: "implementation.models"
flavor: azure
41 changes: 0 additions & 41 deletions .typespec/main.tsp

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// customizations for .NET
import "@azure-tools/typespec-client-generator-core";

import "./models.tsp";

using Azure.ClientGenerator.Core;
Expand Down
47 changes: 47 additions & 0 deletions .typespec/realtime/client.java.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// customizations for Java
import "@azure-tools/typespec-client-generator-core";

import "./models.tsp";

using Azure.ClientGenerator.Core;
using OpenAI;

// RealtimeClientEvent subclass renames
@@clientName(RealtimeClientEventSessionUpdate, "SessionUpdateEvent", "java");
@@clientName(RealtimeClientEventInputAudioBufferAppend, "InputAudioBufferAppendEvent", "java");
@@clientName(RealtimeClientEventInputAudioBufferCommit, "InputAudioBufferCommitEvent", "java");
@@clientName(RealtimeClientEventInputAudioBufferClear, "InputAudioBufferClearEvent", "java");
@@clientName(RealtimeClientEventConversationItemCreate, "ConversationItemCreateEvent", "java");
@@clientName(RealtimeClientEventConversationItemTruncate, "ConversationItemTruncateEvent", "java");
@@clientName(RealtimeClientEventConversationItemDelete, "ConversationItemDeleteEvent", "java");
@@clientName(RealtimeClientEventResponseCreate, "ResponseCreateEvent", "java");
@@clientName(RealtimeClientEventResponseCancel, "ResponseCancelEvent", "java");

// RealtimeServerEvent subclass renames
@@clientName(RealtimeServerEventSessionCreated, "SessionCreatedEvent", "java");
@@clientName(RealtimeServerEventSessionUpdated, "SessionUpdatedEvent", "java");
@@clientName(RealtimeServerEventConversationCreated, "ConversationCreatedEvent", "java");
@@clientName(RealtimeServerEventInputAudioBufferCommitted, "InputAudioBufferCommittedEvent", "java");
@@clientName(RealtimeServerEventInputAudioBufferCleared, "InputAudioBufferClearedEvent", "java");
@@clientName(RealtimeServerEventInputAudioBufferSpeechStarted, "InputAudioBufferSpeechStartedEvent", "java");
@@clientName(RealtimeServerEventInputAudioBufferSpeechStopped, "InputAudioBufferSpeechStoppedEvent", "java");
@@clientName(RealtimeServerEventConversationItemCreated, "ConversationItemCreatedEvent", "java");
@@clientName(RealtimeServerEventConversationItemInputAudioTranscriptionCompleted, "ConversationItemInputAudioTranscriptionCompletedEvent", "java");
@@clientName(RealtimeServerEventConversationItemInputAudioTranscriptionFailed, "ConversationItemInputAudioTranscriptionFailedEvent", "java");
@@clientName(RealtimeServerEventConversationItemTruncated, "ConversationItemTruncatedEvent", "java");
@@clientName(RealtimeServerEventConversationItemDeleted, "ConversationItemDeletedEvent", "java");
@@clientName(RealtimeServerEventResponseCreated, "ResponseCreatedEvent", "java");
@@clientName(RealtimeServerEventResponseDone, "ResponseDoneEvent", "java");
@@clientName(RealtimeServerEventResponseOutputItemAdded, "ResponseOutputItemAddedEvent", "java");
@@clientName(RealtimeServerEventResponseOutputItemDone, "ResponseOutputItemDoneEvent", "java");
@@clientName(RealtimeServerEventResponseContentPartAdded, "ResponseContentPartAddedEvent", "java");
@@clientName(RealtimeServerEventResponseContentPartDone, "ResponseContentPartDoneEvent", "java");
@@clientName(RealtimeServerEventResponseTextDelta, "ResponseTextDeltaEvent", "java");
@@clientName(RealtimeServerEventResponseTextDone, "ResponseTextDoneEvent", "java");
@@clientName(RealtimeServerEventResponseAudioTranscriptDelta, "ResponseAudioTranscriptDeltaEvent", "java");
@@clientName(RealtimeServerEventResponseAudioTranscriptDone, "ResponseAudioTranscriptDoneEvent", "java");
@@clientName(RealtimeServerEventResponseAudioDelta, "ResponseAudioDeltaEvent", "java");
@@clientName(RealtimeServerEventResponseAudioDone, "ResponseAudioDoneEvent", "java");
@@clientName(RealtimeServerEventResponseFunctionCallArgumentsDelta, "ResponseFunctionCallArgumentsDeltaEvent", "java");
@@clientName(RealtimeServerEventResponseFunctionCallArgumentsDone, "ResponseFunctionCallArgumentsDoneEvent", "java");
@@clientName(RealtimeServerEventRateLimitsUpdated, "RateLimitsUpdatedEvent", "java");
2 changes: 0 additions & 2 deletions .typespec/realtime/custom.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import "./custom/events.tsp";
import "./custom/items.tsp";
import "./custom/tools.tsp";

using TypeSpec.OpenAPI;

namespace OpenAI;

model RealtimeRequestSession {
Expand Down
2 changes: 0 additions & 2 deletions .typespec/realtime/custom/content_parts.tsp
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using TypeSpec.OpenAPI;

namespace OpenAI;

union RealtimeContentPartType {
Expand Down
2 changes: 0 additions & 2 deletions .typespec/realtime/custom/events.tsp
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using TypeSpec.OpenAPI;

namespace OpenAI;

union RealtimeClientEventType {
Expand Down
2 changes: 0 additions & 2 deletions .typespec/realtime/custom/items.tsp
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import "./content_parts.tsp";

using TypeSpec.OpenAPI;

namespace OpenAI;

@discriminator("type")
Expand Down
2 changes: 0 additions & 2 deletions .typespec/realtime/custom/tools.tsp
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using TypeSpec.OpenAPI;

namespace OpenAI;

/**
Expand Down
4 changes: 3 additions & 1 deletion .typespec/realtime/main.tsp
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
import "./client.tsp";
import "./client.dotnet.tsp";
import "./client.java.tsp";
import "./operations.tsp";
import "./models.tsp";
2 changes: 0 additions & 2 deletions .typespec/realtime/models.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

import "./custom.tsp";

using TypeSpec.OpenAPI;

namespace OpenAI;

// Tool customization: apply discriminated type base
Expand Down
3 changes: 2 additions & 1 deletion .typespec/realtime/operations.tsp
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import "@typespec/http";

import "./models.tsp";

using TypeSpec.Http;
using TypeSpec.OpenAPI;

namespace OpenAI;

Expand Down