|
| 1 | +# Copyright 2010 New Relic, Inc. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +# Ignore unicode characters in this file from LLM responses |
| 16 | +# ruff: noqa: RUF001 |
| 17 | + |
| 18 | +chat_completion_expected_events = [ |
| 19 | + ( |
| 20 | + {"type": "LlmChatCompletionSummary"}, |
| 21 | + { |
| 22 | + "id": None, # UUID that varies with each run |
| 23 | + "llm.conversation_id": "my-awesome-id", |
| 24 | + "llm.foo": "bar", |
| 25 | + "span_id": None, |
| 26 | + "trace_id": "trace-id", |
| 27 | + "request_id": "c20d345e-6878-4778-b674-6b187bae8ecf", |
| 28 | + "duration": None, # Response time varies each test run |
| 29 | + "request.model": "anthropic.claude-3-sonnet-20240229-v1:0", |
| 30 | + "response.model": "anthropic.claude-3-sonnet-20240229-v1:0", |
| 31 | + "request.temperature": 0.7, |
| 32 | + "request.max_tokens": 100, |
| 33 | + "response.choices.finish_reason": "max_tokens", |
| 34 | + "vendor": "bedrock", |
| 35 | + "ingest_source": "Python", |
| 36 | + "response.number_of_messages": 3, |
| 37 | + }, |
| 38 | + ), |
| 39 | + ( |
| 40 | + {"type": "LlmChatCompletionMessage"}, |
| 41 | + { |
| 42 | + "id": None, # UUID that varies with each run |
| 43 | + "llm.conversation_id": "my-awesome-id", |
| 44 | + "llm.foo": "bar", |
| 45 | + "request_id": "c20d345e-6878-4778-b674-6b187bae8ecf", |
| 46 | + "span_id": None, |
| 47 | + "trace_id": "trace-id", |
| 48 | + "content": "You are a scientist.", |
| 49 | + "role": "system", |
| 50 | + "completion_id": None, |
| 51 | + "sequence": 0, |
| 52 | + "response.model": "anthropic.claude-3-sonnet-20240229-v1:0", |
| 53 | + "vendor": "bedrock", |
| 54 | + "ingest_source": "Python", |
| 55 | + }, |
| 56 | + ), |
| 57 | + ( |
| 58 | + {"type": "LlmChatCompletionMessage"}, |
| 59 | + { |
| 60 | + "id": None, # UUID that varies with each run |
| 61 | + "llm.conversation_id": "my-awesome-id", |
| 62 | + "llm.foo": "bar", |
| 63 | + "request_id": "c20d345e-6878-4778-b674-6b187bae8ecf", |
| 64 | + "span_id": None, |
| 65 | + "trace_id": "trace-id", |
| 66 | + "content": "What is 212 degrees Fahrenheit converted to Celsius?", |
| 67 | + "role": "user", |
| 68 | + "completion_id": None, |
| 69 | + "sequence": 1, |
| 70 | + "response.model": "anthropic.claude-3-sonnet-20240229-v1:0", |
| 71 | + "vendor": "bedrock", |
| 72 | + "ingest_source": "Python", |
| 73 | + }, |
| 74 | + ), |
| 75 | + ( |
| 76 | + {"type": "LlmChatCompletionMessage"}, |
| 77 | + { |
| 78 | + "id": None, # UUID that varies with each run |
| 79 | + "llm.conversation_id": "my-awesome-id", |
| 80 | + "llm.foo": "bar", |
| 81 | + "request_id": "c20d345e-6878-4778-b674-6b187bae8ecf", |
| 82 | + "span_id": None, |
| 83 | + "trace_id": "trace-id", |
| 84 | + "content": "To convert 212°F to Celsius, we can use the formula:\n\nC = (F - 32) × 5/9\n\nWhere:\nC is the temperature in Celsius\nF is the temperature in Fahrenheit\n\nPlugging in 212°F, we get:\n\nC = (212 - 32) × 5/9\nC = 180 × 5/9\nC = 100\n\nTherefore, 212°", |
| 85 | + "role": "assistant", |
| 86 | + "completion_id": None, |
| 87 | + "sequence": 2, |
| 88 | + "response.model": "anthropic.claude-3-sonnet-20240229-v1:0", |
| 89 | + "vendor": "bedrock", |
| 90 | + "ingest_source": "Python", |
| 91 | + "is_response": True, |
| 92 | + }, |
| 93 | + ), |
| 94 | +] |
| 95 | + |
| 96 | +chat_completion_expected_streaming_events = [ |
| 97 | + ( |
| 98 | + {"type": "LlmChatCompletionSummary"}, |
| 99 | + { |
| 100 | + "id": None, # UUID that varies with each run |
| 101 | + "llm.conversation_id": "my-awesome-id", |
| 102 | + "llm.foo": "bar", |
| 103 | + "span_id": None, |
| 104 | + "trace_id": "trace-id", |
| 105 | + "request_id": "f070b880-e0fb-4537-8093-796671c39239", |
| 106 | + "duration": None, # Response time varies each test run |
| 107 | + "request.model": "anthropic.claude-3-sonnet-20240229-v1:0", |
| 108 | + "response.model": "anthropic.claude-3-sonnet-20240229-v1:0", |
| 109 | + "request.temperature": 0.7, |
| 110 | + "request.max_tokens": 100, |
| 111 | + "response.choices.finish_reason": "max_tokens", |
| 112 | + "vendor": "bedrock", |
| 113 | + "ingest_source": "Python", |
| 114 | + "response.number_of_messages": 3, |
| 115 | + }, |
| 116 | + ), |
| 117 | + ( |
| 118 | + {"type": "LlmChatCompletionMessage"}, |
| 119 | + { |
| 120 | + "id": None, # UUID that varies with each run |
| 121 | + "llm.conversation_id": "my-awesome-id", |
| 122 | + "llm.foo": "bar", |
| 123 | + "request_id": "f070b880-e0fb-4537-8093-796671c39239", |
| 124 | + "span_id": None, |
| 125 | + "trace_id": "trace-id", |
| 126 | + "content": "You are a scientist.", |
| 127 | + "role": "system", |
| 128 | + "completion_id": None, |
| 129 | + "sequence": 0, |
| 130 | + "response.model": "anthropic.claude-3-sonnet-20240229-v1:0", |
| 131 | + "vendor": "bedrock", |
| 132 | + "ingest_source": "Python", |
| 133 | + }, |
| 134 | + ), |
| 135 | + ( |
| 136 | + {"type": "LlmChatCompletionMessage"}, |
| 137 | + { |
| 138 | + "id": None, # UUID that varies with each run |
| 139 | + "llm.conversation_id": "my-awesome-id", |
| 140 | + "llm.foo": "bar", |
| 141 | + "request_id": "f070b880-e0fb-4537-8093-796671c39239", |
| 142 | + "span_id": None, |
| 143 | + "trace_id": "trace-id", |
| 144 | + "content": "What is 212 degrees Fahrenheit converted to Celsius?", |
| 145 | + "role": "user", |
| 146 | + "completion_id": None, |
| 147 | + "sequence": 1, |
| 148 | + "response.model": "anthropic.claude-3-sonnet-20240229-v1:0", |
| 149 | + "vendor": "bedrock", |
| 150 | + "ingest_source": "Python", |
| 151 | + }, |
| 152 | + ), |
| 153 | + ( |
| 154 | + {"type": "LlmChatCompletionMessage"}, |
| 155 | + { |
| 156 | + "id": None, # UUID that varies with each run |
| 157 | + "llm.conversation_id": "my-awesome-id", |
| 158 | + "llm.foo": "bar", |
| 159 | + "request_id": "f070b880-e0fb-4537-8093-796671c39239", |
| 160 | + "span_id": None, |
| 161 | + "trace_id": "trace-id", |
| 162 | + "content": "To convert Fahrenheit to Celsius, you use the formula:\n\nC = (F - 32) * 5/9\n\nWhere:\nC is the temperature in Celsius\nF is the temperature in Fahrenheit\n\nPlugging in 212°F for F:\n\nC = (212 - 32) * 5/9\nC = 180 * 5/9\nC = 100\n\nTherefore, 212 degrees Fahren", |
| 163 | + "role": "assistant", |
| 164 | + "completion_id": None, |
| 165 | + "sequence": 2, |
| 166 | + "response.model": "anthropic.claude-3-sonnet-20240229-v1:0", |
| 167 | + "vendor": "bedrock", |
| 168 | + "ingest_source": "Python", |
| 169 | + "is_response": True, |
| 170 | + }, |
| 171 | + ), |
| 172 | +] |
| 173 | + |
| 174 | +chat_completion_invalid_access_key_error_events = [ |
| 175 | + ( |
| 176 | + {"type": "LlmChatCompletionSummary"}, |
| 177 | + { |
| 178 | + "id": None, # UUID that varies with each run |
| 179 | + "llm.conversation_id": "my-awesome-id", |
| 180 | + "llm.foo": "bar", |
| 181 | + "span_id": None, |
| 182 | + "trace_id": "trace-id", |
| 183 | + "request_id": "e1206e19-2318-4a9d-be98-017c73f06118", |
| 184 | + "duration": None, # Response time varies each test run |
| 185 | + "request.model": "anthropic.claude-3-sonnet-20240229-v1:0", |
| 186 | + "response.model": "anthropic.claude-3-sonnet-20240229-v1:0", |
| 187 | + "request.temperature": 0.7, |
| 188 | + "request.max_tokens": 100, |
| 189 | + "vendor": "bedrock", |
| 190 | + "ingest_source": "Python", |
| 191 | + "response.number_of_messages": 1, |
| 192 | + "error": True, |
| 193 | + }, |
| 194 | + ), |
| 195 | + ( |
| 196 | + {"type": "LlmChatCompletionMessage"}, |
| 197 | + { |
| 198 | + "id": None, # UUID that varies with each run |
| 199 | + "llm.conversation_id": "my-awesome-id", |
| 200 | + "llm.foo": "bar", |
| 201 | + "request_id": "e1206e19-2318-4a9d-be98-017c73f06118", |
| 202 | + "span_id": None, |
| 203 | + "trace_id": "trace-id", |
| 204 | + "content": "Invalid Token", |
| 205 | + "role": "user", |
| 206 | + "completion_id": None, |
| 207 | + "sequence": 0, |
| 208 | + "response.model": "anthropic.claude-3-sonnet-20240229-v1:0", |
| 209 | + "vendor": "bedrock", |
| 210 | + "ingest_source": "Python", |
| 211 | + }, |
| 212 | + ), |
| 213 | +] |
| 214 | +chat_completion_invalid_model_error_events = [ |
| 215 | + ( |
| 216 | + {"type": "LlmChatCompletionSummary"}, |
| 217 | + { |
| 218 | + "id": None, # UUID that varies with each run |
| 219 | + "llm.conversation_id": "my-awesome-id", |
| 220 | + "llm.foo": "bar", |
| 221 | + "request_id": "f4908827-3db9-4742-9103-2bbc34578b03", |
| 222 | + "span_id": None, |
| 223 | + "trace_id": "trace-id", |
| 224 | + "duration": None, # Response time varies each test run |
| 225 | + "request.model": "does-not-exist", |
| 226 | + "response.model": "does-not-exist", |
| 227 | + "request.temperature": 0.7, |
| 228 | + "request.max_tokens": 100, |
| 229 | + "response.number_of_messages": 1, |
| 230 | + "vendor": "bedrock", |
| 231 | + "ingest_source": "Python", |
| 232 | + "error": True, |
| 233 | + }, |
| 234 | + ), |
| 235 | + ( |
| 236 | + {"type": "LlmChatCompletionMessage"}, |
| 237 | + { |
| 238 | + "id": None, |
| 239 | + "llm.conversation_id": "my-awesome-id", |
| 240 | + "llm.foo": "bar", |
| 241 | + "span_id": None, |
| 242 | + "trace_id": "trace-id", |
| 243 | + "request_id": "f4908827-3db9-4742-9103-2bbc34578b03", |
| 244 | + "content": "Model does not exist.", |
| 245 | + "role": "user", |
| 246 | + "completion_id": None, |
| 247 | + "response.model": "does-not-exist", |
| 248 | + "sequence": 0, |
| 249 | + "vendor": "bedrock", |
| 250 | + "ingest_source": "Python", |
| 251 | + }, |
| 252 | + ), |
| 253 | +] |
0 commit comments