You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -119,6 +119,14 @@ To send a request to the OpenAI API, build an instance of some `Params` class an
119
119
120
120
For example, `client.chat().completions().create(...)` should be called with an instance of `ChatCompletionCreateParams`, and it will return an instance of `ChatCompletion`.
121
121
122
+
## Immutability
123
+
124
+
Each class in the SDK has an associated [builder](https://blogs.oracle.com/javamagazine/post/exploring-joshua-blochs-builder-design-pattern-in-java) or factory method for constructing it.
125
+
126
+
Each class is [immutable](https://docs.oracle.com/javase/tutorial/essential/concurrency/immutable.html) once constructed. If the class has an associated builder, then it has a `toBuilder()` method, which can be used to convert it back to a builder for making a modified copy.
127
+
128
+
Because each class is immutable, builder modification will _never_ affect already built class instances.
129
+
122
130
## Asynchronous execution
123
131
124
132
The default client is synchronous. To switch to asynchronous execution, call the `async()` method:
0 commit comments