Skip to content

Commit 9004782

Browse files
committed
Merge branch 'refs/heads/main' into trimming
# Conflicts: # OpenAI.sln # src/Custom/Common/InternalListHelpers.cs # src/Custom/OpenAIModelFactory.cs # src/OpenAI.csproj
2 parents ce7228a + 539172f commit 9004782

File tree

1,615 files changed

+79453
-19329
lines changed

Some content is hidden

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

1,615 files changed

+79453
-19329
lines changed

.editorconfig

Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
# editorconfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
[*]
7+
trim_trailing_whitespace = true
8+
9+
# Default settings:
10+
# A newline ending every file
11+
# Use 4 spaces as indentation
12+
[sdk/*/{Azure.*,System.*}/**]
13+
insert_final_newline = true
14+
indent_style = space
15+
indent_size = 4
16+
17+
# C# files
18+
[src/*/{Custom.*}/**.cs]
19+
# New line preferences
20+
csharp_new_line_before_open_brace = all # vs-default: any
21+
csharp_new_line_before_else = true # vs-default: true
22+
csharp_new_line_before_catch = true # vs-default: true
23+
csharp_new_line_before_finally = true # vs-default: true
24+
csharp_new_line_before_members_in_object_initializers = true # vs-default: true
25+
csharp_new_line_before_members_in_anonymous_types = true # vs-default: true
26+
csharp_new_line_between_query_expression_clauses = true # vs-default: true
27+
28+
# Indentation preferences
29+
csharp_indent_block_contents = true # vs-default: true
30+
csharp_indent_braces = false # vs-default: false
31+
csharp_indent_case_contents = true # vs-default: true
32+
csharp_indent_case_contents_when_block = true
33+
csharp_indent_switch_labels = true # vs-default: true
34+
csharp_indent_labels = one_less_than_current # vs-default: one_less_than_current
35+
36+
# Modifier preferences
37+
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion
38+
39+
# avoid this. unless absolutely necessary
40+
dotnet_style_qualification_for_field = false:suggestion # vs-default: false:none
41+
dotnet_style_qualification_for_property = false:suggestion # vs-default: false:none
42+
dotnet_style_qualification_for_method = false:suggestion # vs-default: false:none
43+
dotnet_style_qualification_for_event = false:suggestion # vs-default: false:none
44+
45+
# only use var when it's obvious what the variable type is
46+
csharp_style_var_for_built_in_types = false:none # vs-default: true:none
47+
csharp_style_var_when_type_is_apparent = false:none # vs-default: true:none
48+
csharp_style_var_elsewhere = false:suggestion # vs-default: true:none
49+
50+
# use language keywords instead of BCL types
51+
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion # vs-default: true:none
52+
dotnet_style_predefined_type_for_member_access = true:suggestion # vs-default: true:none
53+
54+
# name all constant fields using PascalCase
55+
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
56+
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
57+
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
58+
59+
dotnet_naming_symbols.constant_fields.applicable_kinds = field
60+
dotnet_naming_symbols.constant_fields.required_modifiers = const
61+
62+
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
63+
64+
# static fields should have s_ prefix
65+
dotnet_naming_rule.static_fields_should_have_prefix.severity = suggestion
66+
dotnet_naming_rule.static_fields_should_have_prefix.symbols = static_fields
67+
dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style
68+
69+
dotnet_naming_symbols.static_fields.applicable_kinds = field
70+
dotnet_naming_symbols.static_fields.required_modifiers = static
71+
dotnet_naming_symbols.static_fields.applicable_accessibilities = private, internal, private_protected
72+
dotnet_naming_style.static_prefix_style.required_prefix = s_
73+
dotnet_naming_style.static_prefix_style.capitalization = camel_case
74+
75+
# internal and private fields should be _camelCase
76+
dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion
77+
dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields
78+
dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style
79+
80+
dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
81+
dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal
82+
83+
dotnet_naming_style.camel_case_underscore_style.required_prefix = _
84+
dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
85+
86+
# Code style defaults
87+
csharp_using_directive_placement = outside_namespace:suggestion
88+
dotnet_sort_system_directives_first = true # vs-default: true
89+
csharp_prefer_braces = true:refactoring
90+
csharp_preserve_single_line_blocks = true # vs-default: true
91+
csharp_preserve_single_line_statements = false # vs-default: true
92+
csharp_prefer_static_local_function = true:suggestion
93+
csharp_prefer_simple_using_statement = false:none
94+
csharp_style_prefer_switch_expression = true:suggestion
95+
96+
# Code quality
97+
dotnet_style_readonly_field = true:suggestion
98+
dotnet_code_quality_unused_parameters = non_public:suggestion
99+
100+
# Expression-level preferences
101+
dotnet_style_object_initializer = true:suggestion # vs-default: true:suggestion
102+
dotnet_style_collection_initializer = true:suggestion # vs-default: true:suggestion
103+
dotnet_style_explicit_tuple_names = true:suggestion # vs-default: true:suggestion
104+
dotnet_style_coalesce_expression = true:suggestion # vs-default: true:suggestion
105+
dotnet_style_null_propagation = true:suggestion # vs-default: true:suggestion
106+
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
107+
dotnet_style_prefer_inferred_tuple_names = true:suggestion
108+
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
109+
dotnet_style_prefer_auto_properties = true:suggestion
110+
dotnet_style_prefer_conditional_expression_over_assignment = true:refactoring
111+
dotnet_style_prefer_conditional_expression_over_return = true:refactoring
112+
csharp_prefer_simple_default_expression = true:suggestion
113+
114+
# Expression-bodied members
115+
csharp_style_expression_bodied_methods = false:none # vs-default: false:none
116+
csharp_style_expression_bodied_constructors = false:none # vs-default: false:none
117+
csharp_style_expression_bodied_operators = false:none # vs-default: false:none
118+
csharp_style_expression_bodied_properties = true:none # vs-default: true:none
119+
csharp_style_expression_bodied_indexers = true:none # vs-default: true:none
120+
csharp_style_expression_bodied_accessors = true:none # vs-default: true:none
121+
csharp_style_expression_bodied_lambdas = true:refactoring
122+
csharp_style_expression_bodied_local_functions = true:refactoring
123+
124+
# Pattern matching
125+
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion # vs-default: true:suggestion
126+
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion # vs-default: true:suggestion
127+
csharp_style_inlined_variable_declaration = true:suggestion # vs-default: true:suggestion
128+
129+
# Null checking preferences
130+
csharp_style_throw_expression = true:suggestion # vs-default: true:suggestion
131+
csharp_style_conditional_delegate_call = true:suggestion # vs-default: true:suggestion
132+
133+
# Other features
134+
csharp_style_prefer_index_operator = false:none
135+
csharp_style_prefer_range_operator = false:none
136+
csharp_style_pattern_local_over_anonymous_function = false:none
137+
138+
# Space preferences
139+
csharp_space_after_cast = false # vs-default: false
140+
csharp_space_after_colon_in_inheritance_clause = true # vs-default: true
141+
csharp_space_after_comma = true # vs-default: true
142+
csharp_space_after_dot = false # vs-default: false
143+
csharp_space_after_keywords_in_control_flow_statements = true # vs-default: true
144+
csharp_space_after_semicolon_in_for_statement = true # vs-default: true
145+
csharp_space_around_binary_operators = before_and_after # vs-default: before_and_after
146+
csharp_space_around_declaration_statements = do_not_ignore # vs-default: false
147+
csharp_space_before_colon_in_inheritance_clause = true # vs-default: true
148+
csharp_space_before_comma = false # vs-default: false
149+
csharp_space_before_dot = false # vs-default: false
150+
csharp_space_before_open_square_brackets = false # vs-default: false
151+
csharp_space_before_semicolon_in_for_statement = false # vs-default: false
152+
csharp_space_between_empty_square_brackets = false # vs-default: false
153+
csharp_space_between_method_call_empty_parameter_list_parentheses = false # vs-default: false
154+
csharp_space_between_method_call_name_and_opening_parenthesis = false # vs-default: false
155+
csharp_space_between_method_call_parameter_list_parentheses = false # vs-default: false
156+
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false # vs-default: false
157+
csharp_space_between_method_declaration_name_and_open_parenthesis = false # vs-default: false
158+
csharp_space_between_method_declaration_parameter_list_parentheses = false # vs-default: false
159+
csharp_space_between_parentheses = false # vs-default: false
160+
csharp_space_between_square_brackets = false # vs-default: false
161+
162+
# Require accessibility modifiers
163+
dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion # vs-default: for_non_interface_members:none
164+
165+
# Analyzers
166+
dotnet_code_quality.ca1802.api_surface = private, internal
167+
168+
# Xml project files
169+
[*.{csproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}]
170+
indent_size = 2
171+
172+
# Xml build files
173+
[*.builds]
174+
indent_size = 2
175+
176+
# Xml files
177+
[*.{xml,stylecop,resx,ruleset}]
178+
indent_size = 2
179+
180+
# Xml config files
181+
[*.{props,targets,config,nuspec}]
182+
indent_size = 2
183+
184+
# Shell scripts
185+
[*.sh]
186+
end_of_line = lf
187+
[*.{cmd, bat}]
188+
end_of_line = crlf

.github/CODEOWNERS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# This file is used to automatically assign reviewers to PRs.
2+
# For more information, see https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
3+
4+
# The '*' pattern represents global owners.
5+
* @joseharriaga @trrwilson @ShivangiReja
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Bug report
2+
description: Report an issue or bug with this library
3+
labels: ['bug']
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: |
8+
Thanks for taking the time to fill out this bug report!
9+
- type: dropdown
10+
id: service-kind
11+
attributes:
12+
label: Service
13+
description: Select whether you are using OpenAI or Azure OpenAI
14+
options:
15+
- OpenAI
16+
- Azure OpenAI
17+
validations:
18+
required: true
19+
- type: textarea
20+
id: what-happened
21+
attributes:
22+
label: Describe the bug
23+
description: A clear and concise description of what the bug is, and any additional context.
24+
placeholder: Tell us what you see.
25+
validations:
26+
required: true
27+
- type: textarea
28+
id: repro-steps
29+
attributes:
30+
label: Steps to reproduce
31+
description: Steps to reproduce the behavior.
32+
placeholder: |
33+
1. Fetch a '...'
34+
2. Update the '....'
35+
3. See error
36+
validations:
37+
required: true
38+
- type: textarea
39+
id: code-snippets
40+
attributes:
41+
label: Code snippets
42+
description: If applicable, add code snippets to help explain your problem.
43+
render: C#
44+
validations:
45+
required: false
46+
- type: input
47+
id: os
48+
attributes:
49+
label: OS
50+
placeholder: winOS
51+
validations:
52+
required: true
53+
- type: input
54+
id: language-version
55+
attributes:
56+
label: .NET version
57+
validations:
58+
required: true
59+
- type: input
60+
id: lib-version
61+
attributes:
62+
label: Library version
63+
validations:
64+
required: true

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: OpenAI support
4+
url: https://help.openai.com/
5+
about: |
6+
Please only file issues here that you believe represent actual bugs or feature requests for the OpenAI .NET library.
7+
If you're having general trouble with the OpenAI API, please visit our help center to get support.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Feature request
2+
description: Suggest an idea for this library
3+
labels: ['feature-request']
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: |
8+
Thanks for taking the time to fill out this feature request!
9+
- type: checkboxes
10+
id: non_api
11+
attributes:
12+
label: Confirm this is a feature request for the .NET library and not the underlying OpenAI API
13+
description: Feature requests for the underlying OpenAI API should be reported on our [Developer Community](https://community.openai.com/c/api/7)
14+
options:
15+
- label: This is a feature request for the .NET library
16+
required: true
17+
- type: textarea
18+
id: feature
19+
attributes:
20+
label: Describe the feature or improvement you are requesting
21+
description: A clear and concise description of what you want to happen.
22+
validations:
23+
required: true
24+
- type: textarea
25+
id: context
26+
attributes:
27+
label: Additional context
28+
description: Add any other context about the feature request here.

.github/workflows/live-test.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# This workflow is triggered by the user and runs live tests on the codebase.
2+
name: Live Test
3+
4+
on:
5+
workflow_dispatch:
6+
pull_request:
7+
types:
8+
- labeled
9+
10+
jobs:
11+
test:
12+
name: Live Test
13+
runs-on: ubuntu-latest
14+
if: github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'live test')
15+
environment: Live Testing
16+
env:
17+
version_suffix_args: ${{ format('/p:VersionSuffix="alpha.{0}"', github.run_number) }}
18+
steps:
19+
- name: Setup .NET
20+
uses: actions/setup-dotnet@v3
21+
with:
22+
dotnet-version: '8.x'
23+
24+
- name: Checkout code
25+
uses: actions/checkout@v2
26+
27+
- name: Run live tests
28+
run: dotnet test ./tests/OpenAI.Tests.csproj
29+
--configuration Release
30+
--filter="TestCategory!=Smoke&TestCategory!=Images&TestCategory!=Uploads&TestCategory!=Moderations&TestCategory!=FineTuning&TestCategory!=Conversation&TestCategory!=Manual"
31+
--logger "trx;LogFilePrefix=live"
32+
--results-directory ${{github.workspace}}/artifacts/test-results
33+
${{ env.version_suffix_args}}
34+
env:
35+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
36+
37+
- name: Upload artifact
38+
uses: actions/upload-artifact@v4
39+
if: ${{ !cancelled() }}
40+
with:
41+
name: test-artifacts
42+
path: ${{github.workspace}}/artifacts

0 commit comments

Comments
 (0)