Skip to content

Commit 5988a88

Browse files
committed
merge
2 parents af456ab + 7c91d8d commit 5988a88

File tree

669 files changed

+82778
-73682
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

669 files changed

+82778
-73682
lines changed

.config/dotnet-tools.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"version": 1,
3+
"isRoot": true,
4+
"tools": {
5+
"Azure.Sdk.Tools.SnippetGenerator": {
6+
"version": "1.0.0-dev.20241213.1",
7+
"commands": [
8+
"snippet-generator"
9+
],
10+
"rollForward": false
11+
}
12+
}
13+
}
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Update TypeSpec Generator Version
2+
3+
on:
4+
schedule:
5+
# Run weekly on Mondays at 9 AM UTC
6+
- cron: '0 9 * * 1'
7+
workflow_dispatch:
8+
# Allow manual triggering
9+
repository_dispatch:
10+
# Allow triggering from TypeSpec repository on new releases
11+
types: [typespec-release]
12+
13+
jobs:
14+
update-generator:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: write
18+
pull-requests: write
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
with:
24+
token: ${{ secrets.GITHUB_TOKEN }}
25+
26+
- name: Setup Node.js
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: '22.x'
30+
31+
- name: Setup .NET
32+
uses: actions/setup-dotnet@v4
33+
with:
34+
# Automatically read .NET SDK version from global.json to stay in sync
35+
global-json-file: global.json
36+
37+
- name: Check for generator updates
38+
id: check-updates
39+
run: |
40+
# Get current version from the OpenAI package.json file
41+
CURRENT_VERSION=$(node -p "require('./codegen/package.json').dependencies['@typespec/http-client-csharp']" 2>/dev/null || echo "unknown")
42+
43+
echo "Current OpenAI version: $CURRENT_VERSION"
44+
45+
# Get latest version from npm registry
46+
LATEST_VERSION=$(npm view @typespec/http-client-csharp version 2>/dev/null || echo "unknown")
47+
echo "Latest version from npm: $LATEST_VERSION"
48+
49+
# Validate we got valid versions
50+
if [ "$CURRENT_VERSION" = "unknown" ] || [ "$LATEST_VERSION" = "unknown" ]; then
51+
echo "Error: Failed to get version information"
52+
echo "Current: $CURRENT_VERSION, Latest: $LATEST_VERSION"
53+
exit 1
54+
fi
55+
56+
# Compare versions (simple string comparison for alpha versions)
57+
if [ "$CURRENT_VERSION" != "$LATEST_VERSION" ]; then
58+
echo "Update needed: $CURRENT_VERSION -> $LATEST_VERSION"
59+
echo "needs-update=true" >> $GITHUB_OUTPUT
60+
echo "current-version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
61+
echo "latest-version=$LATEST_VERSION" >> $GITHUB_OUTPUT
62+
else
63+
echo "No update needed - already at latest version: $CURRENT_VERSION"
64+
echo "needs-update=false" >> $GITHUB_OUTPUT
65+
fi
66+
67+
- name: Update generator version and create PR
68+
if: steps.check-updates.outputs.needs-update == 'true'
69+
run: |
70+
LATEST_VERSION="${{ steps.check-updates.outputs.latest-version }}"
71+
72+
# Use the PowerShell script to handle the entire update process (following TypeSpec pattern)
73+
pwsh ./scripts/Submit-GeneratorUpdatePr.ps1 \
74+
-PackageVersion "$LATEST_VERSION" \
75+
-AuthToken "${{ secrets.GITHUB_TOKEN }}" \
76+
-RepoPath "."

README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -519,14 +519,19 @@ await foreach (StreamingResponseUpdate update
519519
},
520520
}))
521521
{
522-
if (update is StreamingResponseItemUpdate itemUpdate
522+
if (update is StreamingResponseOutputItemAddedUpdate itemUpdate
523523
&& itemUpdate.Item is ReasoningResponseItem reasoningItem)
524524
{
525525
Console.WriteLine($"[Reasoning] ({reasoningItem.Status})");
526526
}
527-
else if (update is StreamingResponseContentPartDeltaUpdate deltaUpdate)
527+
else if (update is StreamingResponseOutputItemAddedUpdate itemDone
528+
&& itemDone.Item is ReasoningResponseItem reasoningDone)
528529
{
529-
Console.Write(deltaUpdate.Text);
530+
Console.WriteLine($"[Reasoning DONE] ({reasoningDone.Status})");
531+
}
532+
else if (update is StreamingResponseOutputTextDeltaUpdate delta)
533+
{
534+
Console.Write(delta.Delta);
530535
}
531536
}
532537
```

api/OpenAI.net8.0.cs

Lines changed: 275 additions & 84 deletions
Large diffs are not rendered by default.

api/OpenAI.netstandard2.0.cs

Lines changed: 254 additions & 78 deletions
Large diffs are not rendered by default.

codegen/generator/src/OpenAI.Library.Plugin.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="Microsoft.TypeSpec.Generator.ClientModel" Version="1.0.0-alpha.20250626.7" />
11+
<PackageReference Include="Microsoft.TypeSpec.Generator.ClientModel" Version="1.0.0-alpha.20250827.2" />
1212
</ItemGroup>
1313

1414
<!-- Copy output to package dist path for local execution and -->

codegen/generator/src/OpenAILibraryGenerator.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,8 @@ namespace OpenAILibraryPlugin
1010
[ExportMetadata("GeneratorName", nameof(OpenAILibraryGenerator))]
1111
public class OpenAILibraryGenerator : ScmCodeModelGenerator
1212
{
13-
private static OpenAILibraryGenerator? s_instance;
14-
internal static OpenAILibraryGenerator Instance => s_instance ?? throw new InvalidOperationException("OpenAILibraryGenerator was not initialized.");
15-
1613
[ImportingConstructor]
17-
public OpenAILibraryGenerator(GeneratorContext context) : base(context)
18-
{
19-
s_instance = this;
20-
}
14+
public OpenAILibraryGenerator(GeneratorContext context) : base(context) { }
2115

2216
protected override void Configure()
2317
{
@@ -33,7 +27,6 @@ protected override void Configure()
3327
AddVisitor(new OpenAILibraryVisitor());
3428
AddVisitor(new VirtualMessageCreationVisitor());
3529
AddVisitor(new ProhibitedNamespaceVisitor());
36-
AddVisitor(new ExplicitConversionFromClientResultVisitor());
3730
AddVisitor(new ImplicitConversionToBinaryContentVisitor());
3831
AddVisitor(new ModelSerializationVisitor());
3932
AddVisitor(new ExperimentalAttributeVisitor());

codegen/generator/src/Visitors/ContentInnerCollectionDefinedVisitor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public class ContentInnerCollectionDefinedVisitor : ScmLibraryVisitor
1717
{
1818
private const string Comment = "Plugin customization: add Content.IsInnerCollectionDefined() check";
1919

20-
protected override MethodProvider VisitMethod(MethodProvider method)
20+
protected override MethodProvider? VisitMethod(MethodProvider method)
2121
{
2222
if (method.Signature.Name != "JsonModelWriteCore"
2323
|| method.BodyStatements is not MethodBodyStatements methodBodyStatements)

codegen/generator/src/Visitors/ExperimentalAttributeVisitor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ public class ExperimentalAttributeVisitor : ScmLibraryVisitor
612612
"ComputerCallResponseItem",
613613
"ComputerCallSafetyCheck",
614614
"ComputerCallStatus",
615-
"ComputerOutput",
615+
"ComputerCallOutput",
616616
"ComputerToolEnvironment",
617617
};
618618

codegen/generator/src/Visitors/ExplicitConversionFromClientResultVisitor.cs

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)