Skip to content

Commit 81c4795

Browse files
authored
Update file-based apps to be aligned with .NET 10 RC1 (#681)
This PR is mainly for fixing two things: - Updated the `#:property` directive to be working with .NET 10 RC1. - Updated the OpenAI SDK package to use `2.*` instead of `2.2.*-*`. - Added the `OPENAI001` warning suppressions for some methods.
1 parent 7af490a commit 81c4795

File tree

10 files changed

+47
-35
lines changed

10 files changed

+47
-35
lines changed

docs/guides/global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"sdk": {
3-
"version": "10.*-preview"
3+
"version": "10.*-rc*"
44
}
55
}

docs/guides/text/chat/chat_instructions.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// SAMPLE: Generate text with messages using different roles
2-
// GUIDANCE: Instructions to run this code: https://aka.ms/oai/net/start
3-
#:package OpenAI@2.2.*-*
4-
#:property PublishAot false
2+
// GUIDANCE: Instructions to run this code: https://aka.ms/oai/net/start
3+
#:package OpenAI@2.*
4+
#:property PublishAot=false
55

6-
using OpenAI.Chat;
6+
using OpenAI.Chat;
77

88
string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;
99
ChatClient client = new("gpt-4.1", key);

docs/guides/text/chat/chat_roles.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
// SAMPLE: Generate text with messages using different roles
2-
// GUIDANCE: Instructions to run this code: https://aka.ms/oai/net/start
3-
#:package OpenAI@2.2.*-*
4-
#:property PublishAot false
2+
// GUIDANCE: Instructions to run this code: https://aka.ms/oai/net/start
3+
#pragma warning disable OPENAI001
54

6-
using OpenAI.Chat;
5+
#:package OpenAI@2.*
6+
#:property PublishAot=false
7+
8+
using OpenAI.Chat;
79

810
string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;
911
ChatClient client = new("gpt-4.1", key);

docs/guides/text/chat/chat_simpleprompt.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// SAMPLE: Generate text from a simple prompt
2-
// GUIDANCE: Instructions to run this code: https://aka.ms/oai/net/start
3-
#:package OpenAI@2.2.*-*
4-
#:property PublishAot false
2+
// GUIDANCE: Instructions to run this code: https://aka.ms/oai/net/start
3+
#:package OpenAI@2.*
4+
#:property PublishAot=false
55

6-
using OpenAI.Chat;
6+
using OpenAI.Chat;
77

88
string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;
99
ChatClient client = new("gpt-4.1", key);

docs/guides/text/chat/chat_tools.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// SAMPLE: Generate text from a simple prompt
2-
// GUIDANCE: Instructions to run this code: https://aka.ms/oai/net/start
3-
#:package OpenAI@2.2.*-*
2+
// GUIDANCE: Instructions to run this code: https://aka.ms/oai/net/start
3+
#:package OpenAI@2.*
44
#:property PublishAot=false
55

6-
using OpenAI.Chat;
6+
using OpenAI.Chat;
77

88
string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;
99
ChatClient client = new("gpt-4.1", key);
@@ -15,7 +15,7 @@
1515
functionParameters: BinaryData.FromObjectAsJson(new
1616
{
1717
type = "object",
18-
properties = new
18+
properties = new
1919
{
2020
utc = new
2121
{

docs/guides/text/responses/responses_fileinput.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
// SAMPLE: Prompt template with file input variable
2-
// GUIDANCE: Instructions to run this code: https://aka.ms/oai/net/start
3-
#:package OpenAI@2.2.*-*
4-
#:property PublishAot false
2+
// GUIDANCE: Instructions to run this code: https://aka.ms/oai/net/start
3+
#pragma warning disable OPENAI001
4+
5+
#:package OpenAI@2.*
6+
#:property PublishAot=false
57

68
using OpenAI.Responses;
79
using OpenAI.Files;

docs/guides/text/responses/responses_instructions.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
// SAMPLE: Generate text with instructions
2-
// GUIDANCE: Instructions to run this code: https://aka.ms/oai/net/start
3-
#:package OpenAI@2.2.*-*
4-
#:property PublishAot false
2+
// GUIDANCE: Instructions to run this code: https://aka.ms/oai/net/start
3+
#pragma warning disable OPENAI001
54

6-
using OpenAI.Responses;
5+
#:package OpenAI@2.*
6+
#:property PublishAot=false
7+
8+
using OpenAI.Responses;
79

810
string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;
911
OpenAIResponseClient client = new("gpt-4.1", key);

docs/guides/text/responses/responses_prompttemplate.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
// SAMPLE: Generate text with a prompt template
2-
// GUIDANCE: Instructions to run this code: https://aka.ms/oai/net/start
3-
#:package OpenAI@2.2.*-*
4-
#:property PublishAot false
2+
// GUIDANCE: Instructions to run this code: https://aka.ms/oai/net/start
3+
#pragma warning disable OPENAI001
4+
5+
#:package OpenAI@2.*
6+
#:property PublishAot=false
57

68
using OpenAI.Responses;
79
using System.ClientModel;

docs/guides/text/responses/responses_roles.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
// SAMPLE: Generate text with messages using different roles
2-
// GUIDANCE: Instructions to run this code: https://aka.ms/oai/net/start
3-
#:package OpenAI@2.2.*-*
4-
#:property PublishAot false
2+
// GUIDANCE: Instructions to run this code: https://aka.ms/oai/net/start
3+
#pragma warning disable OPENAI001
54

6-
using OpenAI.Responses;
5+
#:package OpenAI@2.*
6+
#:property PublishAot=false
7+
8+
using OpenAI.Responses;
79

810
string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;
911
OpenAIResponseClient client = new("gpt-4.1", key);

docs/guides/text/responses/responses_simpleprompt.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
// SAMPLE: Generate text from a simple prompt
2-
// GUIDANCE: Instructions to run this code: https://aka.ms/oai/net/start
3-
#:package OpenAI@2.2.*-*
4-
#:property PublishAot false
2+
// GUIDANCE: Instructions to run this code: https://aka.ms/oai/net/start
3+
#pragma warning disable OPENAI001
54

6-
using OpenAI.Responses;
5+
#:package OpenAI@2.*
6+
#:property PublishAot=false
7+
8+
using OpenAI.Responses;
79

810
string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;
911
OpenAIResponseClient client = new("gpt-4.1", key);

0 commit comments

Comments
 (0)