hezarfen_backend
Clone
https://git.tahinli.com/archive/hezarfen_backend.git
0 watching0 forksRust8.3 MiB6d68754Ahmet Kaan Gümüş2 months ago566 commits
| 1 | //! Payload contract for the `chat.reply` capability. |
| 2 | //! |
| 3 | //! The transport is untouched: this is JSON that rides inside the existing |
| 4 | //! [`Request::payload`](crate::ai::protocol::Request::payload) and comes back |
| 5 | //! inside [`Response::Ok`](crate::ai::protocol::Response::Ok)`::payload`. One |
| 6 | //! request, one answer — the exchange stays unary, so a service answers with |
| 7 | //! the whole reply text rather than streaming tokens. |
| 8 | //! |
| 9 | //! The service is stateless about conversations. The backend owns the thread |
| 10 | //! and re-sends the relevant tail of it on every turn, which means a service |
| 11 | //! may restart, scale out, or be replaced mid-conversation without losing |
| 12 | //! context. |
| 13 | |
| 14 | use ; |
| 15 | |
| 16 | /// The capability string routed to a chat service. Defined once, in |
| 17 | /// [`crate::constant`]; re-exported here so a reader of the payload contract |
| 18 | /// finds it next to the payloads. |
| 19 | pub use crateAI_CHAT_CAPABILITY; |
| 20 | |
| 21 | /// Who said a turn. Serialises to `"user"` / `"assistant"` — the two names |
| 22 | /// every chat model API already uses, so a service can hand the history to its |
| 23 | /// model with no remapping. |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | /// One previous message in the conversation. |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | /// What the backend asks a chat service to answer. |
| 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 | /// The service's answer, inside `Response::Ok { payload }`. |
| 66 | /// |
| 67 | /// Handled failures do *not* come back here — they use the existing |
| 68 | /// [`Response::Err`](crate::ai::protocol::Response::Err) `{ code, message }`, |
| 69 | /// so there is exactly one failure shape on the bridge for every capability. |
| 70 | |
| 71 | |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | |
| 82 | |
| 83 | |
| 84 | |
| 85 | |
| 86 | |
| 87 | |
| 88 | |
| 89 | |
| 90 | |
| 91 | |
| 92 | |
| 93 | |
| 94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | |
| 101 | |
| 102 | |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
| 107 | |
| 108 | |
| 109 | |
| 110 | |
| 111 | |
| 112 | |
| 113 | |
| 114 | |
| 115 | |
| 116 | |
| 117 | |
| 118 | |
| 119 | |
| 120 | |
| 121 | |
| 122 | |
| 123 | |
| 124 | |
| 125 | |
| 126 | |
| 127 | |
| 128 | |
| 129 | |
| 130 | |
| 131 | |
| 132 | |
| 133 | |
| 134 | |
| 135 | |
| 136 | |
| 137 | |
| 138 | |
| 139 | |
| 140 | |
| 141 | |
| 142 | |
| 143 | |
| 144 | |
| 145 | |
| 146 | |
| 147 | |
| 148 | |
| 149 | |
| 150 | |
| 151 | |
| 152 | |
| 153 | |
| 154 | |
| 155 | |
| 156 | |
| 157 | |
| 158 | |
| 159 | |
| 160 | |
| 161 | |
| 162 | |
| 163 | |
| 164 | |
| 165 | |
| 166 | |
| 167 | |
| 168 | |
| 169 | |
| 170 | |
| 171 | |
| 172 | |
| 173 | |
| 174 | |
| 175 | |
| 176 | |
| 177 | |
| 178 | |
| 179 | |
| 180 | |
| 181 | |
| 182 | |
| 183 | |
| 184 | |
| 185 | |
| 186 | |
| 187 | |
| 188 | |
| 189 | |
| 190 | |
| 191 | |
| 192 | |
| 193 | |
| 194 |