generate.proto 2.5 KB
Newer Older
Olivier Dehaene's avatar
Init  
Olivier Dehaene committed
1
2
3
4
syntax = "proto3";

package generate.v1;

Olivier Dehaene's avatar
Olivier Dehaene committed
5
service TextGenerationService {
Olivier Dehaene's avatar
Init  
Olivier Dehaene committed
6
    /// Service discovery
Olivier Dehaene's avatar
Olivier Dehaene committed
7
    rpc ServiceDiscovery (ServiceDiscoveryRequest) returns (ServiceDiscoveryResponse) {}
Olivier Dehaene's avatar
Init  
Olivier Dehaene committed
8
    /// Empties batch cache
Olivier Dehaene's avatar
Olivier Dehaene committed
9
10
11
12
13
    rpc ClearCache (ClearCacheRequest) returns (ClearCacheResponse);
    /// Generate tokens for a batch
    rpc Generate (GenerateRequest) returns (GenerateResponse);
    /// Generate tokens for a list of cached batches
    rpc GenerateWithCache (GenerateWithCacheRequest) returns (GenerateWithCacheResponse);
Olivier Dehaene's avatar
Init  
Olivier Dehaene committed
14
15
}

Olivier Dehaene's avatar
Olivier Dehaene committed
16
17
18
/// Empty request
message ServiceDiscoveryRequest {}

Olivier Dehaene's avatar
Init  
Olivier Dehaene committed
19
message ServiceDiscoveryResponse {
Olivier Dehaene's avatar
Olivier Dehaene committed
20
    /// Other shards urls
Olivier Dehaene's avatar
Init  
Olivier Dehaene committed
21
22
23
    repeated string urls = 1;
}

Olivier Dehaene's avatar
Olivier Dehaene committed
24
25
26
27
28
29
/// Empty request
message ClearCacheRequest {}

/// Empty response
message ClearCacheResponse {}

Olivier Dehaene's avatar
Init  
Olivier Dehaene committed
30
message LogitsWarperParameters {
31
    /// exponential scaling output probability distribution
Olivier Dehaene's avatar
Init  
Olivier Dehaene committed
32
    float temperature = 1;
33
    /// restricting to the k highest probability elements
Olivier Dehaene's avatar
Init  
Olivier Dehaene committed
34
    uint32 top_k = 2;
35
    /// restricting to top tokens summing to prob_cut_off <= prob_cut_off
Olivier Dehaene's avatar
Init  
Olivier Dehaene committed
36
    float top_p = 3;
37
    /// apply sampling on the logits
Olivier Dehaene's avatar
Init  
Olivier Dehaene committed
38
39
40
    bool do_sample = 4;
}

41
42
43
44
45
46
47
message StoppingCriteriaParameters {
    /// Maximum number of generated tokens
    uint32 max_new_tokens = 1;
    /// Optional stopping sequences
    repeated string stop_sequences = 2;
}

Olivier Dehaene's avatar
Init  
Olivier Dehaene committed
48
49
50
51
52
message Request {
    /// Request ID
    uint64 id = 1;
    /// The generation context
    string inputs = 2;
Olivier Dehaene's avatar
Olivier Dehaene committed
53
54
    /// The number of tokens inside inputs
    uint32 input_length = 3;
Olivier Dehaene's avatar
Init  
Olivier Dehaene committed
55
    /// Logits Warper Parameters
Olivier Dehaene's avatar
Olivier Dehaene committed
56
    LogitsWarperParameters parameters = 4;
57
58
    /// Stopping Criteria Parameters
    StoppingCriteriaParameters stopping_parameters = 5;
Olivier Dehaene's avatar
Init  
Olivier Dehaene committed
59
60
61
62
63
64
65
}

message Batch {
    /// Batch ID
    uint64 id = 1;
    /// Individual requests
    repeated Request requests = 2;
Olivier Dehaene's avatar
Olivier Dehaene committed
66
67
    /// Batch size (==len(requests))
    uint32 size = 3;
Olivier Dehaene's avatar
Init  
Olivier Dehaene committed
68
69
}

Olivier Dehaene's avatar
Olivier Dehaene committed
70
71
72
message GeneratedText {
    /// Request
    Request request = 1;
Olivier Dehaene's avatar
Init  
Olivier Dehaene committed
73
74
    /// Output
    string output = 2;
75
76
    /// Number of generated tokens
    uint32 tokens = 3;
77
78
    /// Finish reason
    string finish_reason = 4;
Olivier Dehaene's avatar
Init  
Olivier Dehaene committed
79
80
}

Olivier Dehaene's avatar
Olivier Dehaene committed
81
82
83
message GenerateRequest {
    /// Batch
    Batch batch = 1;
Olivier Dehaene's avatar
Init  
Olivier Dehaene committed
84
85
}

Olivier Dehaene's avatar
Olivier Dehaene committed
86
87
88
89
90
message GenerateResponse {
    /// Finished requests
    repeated GeneratedText generated_texts = 1;
    /// Next batch (cached)
    optional Batch batch = 2;
Olivier Dehaene's avatar
Init  
Olivier Dehaene committed
91
92
}

Olivier Dehaene's avatar
Olivier Dehaene committed
93
94
95
96
message GenerateWithCacheRequest {
    /// Cached batches
    repeated Batch batches = 1;
}
Olivier Dehaene's avatar
Init  
Olivier Dehaene committed
97

Olivier Dehaene's avatar
Olivier Dehaene committed
98
99
100
101
102
103
message GenerateWithCacheResponse {
    /// Finished requests
    repeated GeneratedText generated_texts = 1;
    /// Next batch (cached)
    optional Batch batch = 2;
}