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
Copy file name to clipboardExpand all lines: java-vertexai/README.md
+89-1
Original file line number
Diff line number
Diff line change
@@ -89,6 +89,7 @@ to add `google-cloud-vertexai` as a dependency in your code.
89
89
### Vertex AI SDK
90
90
Vertex AI provides [Generative AI Studio](generative-ai-studio) that supports text generation from multi-modality input via a set of most advanced models from Google. This brings out a wide range of applications.
91
91
92
+
#### Basic Text Generation
92
93
Vertex AI SDK allows you to access the service programmatically. The following code snippet is the most basic usage of SDK
93
94
94
95
```java
@@ -115,6 +116,7 @@ public class Main {
115
116
}
116
117
```
117
118
119
+
#### Text Generation with Streaming
118
120
To get a streamed output, you can use the `generateContentStream` method
119
121
120
122
```java
@@ -142,6 +144,7 @@ public class Main {
142
144
}
143
145
```
144
146
147
+
#### Text Generation from Multi-modal Input
145
148
To generate text based on data of multiple modalities, one needs to make a `Content`, which is made easier by `ContentMaker`:
146
149
147
150
```java
@@ -176,6 +179,7 @@ public class Main {
176
179
}
177
180
```
178
181
182
+
#### RoleChangeforMulti-turn Conversation
179
183
For a multi-turn conversation, one needs to make a `Content` list to represent the whole conversation between two roles:"user" and "model".
180
184
181
185
```java
@@ -222,6 +226,7 @@ public class Main {
222
226
}
223
227
```
224
228
229
+
#### UsingChatSessionforMulti-turn Conversation
225
230
Yeah, we know, that isn't the most intuitive and easy way to chat with a model. Therefore we provide a `Chat` class:
See the [Vertex AI SDK docs][javadocs] to learn more about how to use this Vertex AI SDK in more advanced ways.
271
358
272
359
## Troubleshooting
273
360
274
361
To get help, follow the instructions in the [shared Troubleshooting document][troubleshooting].
275
362
276
-
## Transport
363
+
## Other Configurations
364
+
### Transport
277
365
278
366
Vertex AI uses gRPC and rest for the transport layer. By default, we use gRPC transport. To use rest, passing a `Transport.REST` to the `VertexAI` constructor as the example below:
0 commit comments