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: README.md
+17-9Lines changed: 17 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,9 +23,14 @@ This package provides a powerful bridge between your Flutter application and Goo
23
23
24
24
To use the Gemini API, you'll need an API key. If you don't already have one, create a key in Google AI Studio. [Get an API key](https://ai.google.dev/).
To initialize Gemini you must add an init factory in the main function.
32
+
For initialization, you must call the init constructor for Flutter Gemini in the main function.
33
+
29
34
```dart
30
35
void main() {
31
36
@@ -38,24 +43,22 @@ void main() {
38
43
39
44
Now you can create an instance
40
45
41
-
```dart
42
-
final gemini = Gemini.instance;
43
-
```
44
-
45
46
## Content-based APIs
46
47
47
48
### Text-only input
48
49
49
50
This feature lets you perform natural language processing (NLP) tasks such as text completion and summarization.
50
51
51
52
```dart
52
-
final gemini = Gemini.instance;
53
+
final gemini = Gemini.instance;
53
54
54
-
gemini.text("Write a story about a magic backpack.")
55
-
.then((value) => print( value?.output )) /// or value?.content?.parts?.last.text
56
-
.catchError((e) => print(e));
55
+
gemini.text("Write a story about a magic backpack.")
56
+
.then((value) => print( value?.output )) /// or value?.content?.parts?.last.text
57
+
.catchError((e) => print(e));
57
58
```
58
59
60
+

61
+
59
62
### Text-and-image input
60
63
61
64
If the input contains both text and image, You can send a text prompt with an image to the gemini-pro-vision model to perform a vision-related task. For example, captioning an image or identifying what's in an image.
@@ -72,6 +75,8 @@ If the input contains both text and image, You can send a text prompt with an im

79
+
75
80
76
81
### Multi-turn conversations (chat)
77
82
@@ -96,6 +101,9 @@ Using Gemini, you can build freeform conversations across multiple turns.
96
101
```
97
102
98
103
104
+

105
+
106
+
99
107
### Count tokens
100
108
101
109
When using long prompts, it might be useful to count tokens before sending any content to the model.
0 commit comments