-
Notifications
You must be signed in to change notification settings - Fork 0
/
gemini-pro.http
93 lines (76 loc) · 2.23 KB
/
gemini-pro.http
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# For more info on HTTP files go to https://aka.ms/vs/httpfile
@apiKey={{$dotenv API_KEY}}
@version=v1beta
@model=gemini-pro
# Get a list of available models and description
GET https://generativelanguage.googleapis.com/{{version}}/models?key={{apiKey}}
###
# Get information about the model, including default values
GET https://generativelanguage.googleapis.com/{{version}}/models/{{model}}?key={{apiKey}}
###
# Send a text-only request
POST https://generativelanguage.googleapis.com/{{version}}/models/{{model}}:generateContent?key={{apiKey}}
Content-Type: application/json
{
"contents": [{
"parts": [{
"text": "Write a story about a magic backpack."
}]
}]
}
###
# Send a text-only request with model parameters and safety settings
# Ref: https://ai.google.dev/docs/concepts#model-parameters
POST https://generativelanguage.googleapis.com/{{version}}/models/{{model}}:generateContent?key={{apiKey}}
Content-Type: application/json
{
"contents": [{
"parts": [{
"text": "Write a story about a magic backpack."
}]
}],
"safetySettings": [
{
"category": "HARM_CATEGORY_DANGEROUS_CONTENT",
"threshold": "BLOCK_ONLY_HIGH"
}
],
"generationConfig": {
"stopSequences": [
"Title"
],
"temperature": 1.0,
"maxOutputTokens": 800,
"topP": 0.8,
"topK": 10
}
}
###
# Count tokens for a long prompt
POST https://generativelanguage.googleapis.com/{{version}}/models/{{model}}:countTokens?key={{apiKey}}
Content-Type: application/json
{
"contents": [{
"parts": [{
"text": "Write an extended story about a magic backpack."
}]
}]
}
###
# Using multi-turn conversations (chat)
POST https://generativelanguage.googleapis.com/{{version}}/models/{{model}}:generateContent?key={{apiKey}}
Content-Type: application/json
{
"contents": [
{"role": "user",
"parts": [{
"text": "Write the first line of a story about a magic backpack."}]},
{"role": "model",
"parts": [{
"text": "In the bustling city of Meadow brook, lived a young girl named Sophie. She was a bright and curious soul with an imaginative mind."}]},
{"role": "user",
"parts": [{
"text": "Can you set it in a quiet village in 1600s France?"}]},
]
}
###