gen_ai_attributes.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494
  1. /*
  2. * Copyright The OpenTelemetry Authors
  3. * SPDX-License-Identifier: Apache-2.0
  4. */
  5. /*
  6. * DO NOT EDIT, this is an Auto-generated file from:
  7. * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2
  8. */
  9. #pragma once
  10. #include "opentelemetry/common/macros.h"
  11. #include "opentelemetry/version.h"
  12. OPENTELEMETRY_BEGIN_NAMESPACE
  13. namespace semconv
  14. {
  15. namespace gen_ai
  16. {
  17. /**
  18. Free-form description of the GenAI agent provided by the application.
  19. */
  20. static constexpr const char *kGenAiAgentDescription = "gen_ai.agent.description";
  21. /**
  22. The unique identifier of the GenAI agent.
  23. */
  24. static constexpr const char *kGenAiAgentId = "gen_ai.agent.id";
  25. /**
  26. Human-readable name of the GenAI agent provided by the application.
  27. */
  28. static constexpr const char *kGenAiAgentName = "gen_ai.agent.name";
  29. /**
  30. Deprecated, use Event API to report completions contents.
  31. @deprecated
  32. {"note": "Removed, no replacement at this time.", "reason": "obsoleted"}
  33. */
  34. OPENTELEMETRY_DEPRECATED static constexpr const char *kGenAiCompletion = "gen_ai.completion";
  35. /**
  36. The unique identifier for a conversation (session, thread), used to store and correlate messages
  37. within this conversation.
  38. */
  39. static constexpr const char *kGenAiConversationId = "gen_ai.conversation.id";
  40. /**
  41. The data source identifier.
  42. <p>
  43. Data sources are used by AI agents and RAG applications to store grounding data. A data source may
  44. be an external database, object store, document collection, website, or any other storage system
  45. used by the GenAI agent or application. The @code gen_ai.data_source.id @endcode SHOULD match the
  46. identifier used by the GenAI system rather than a name specific to the external storage, such as a
  47. database or object store. Semantic conventions referencing @code gen_ai.data_source.id @endcode
  48. MAY also leverage additional attributes, such as @code db.* @endcode, to further identify and
  49. describe the data source.
  50. */
  51. static constexpr const char *kGenAiDataSourceId = "gen_ai.data_source.id";
  52. /**
  53. Deprecated, use @code gen_ai.output.type @endcode.
  54. @deprecated
  55. {"note": "Replaced by @code gen_ai.output.type @endcode.", "reason": "renamed", "renamed_to":
  56. "gen_ai.output.type"}
  57. */
  58. OPENTELEMETRY_DEPRECATED static constexpr const char *kGenAiOpenaiRequestResponseFormat =
  59. "gen_ai.openai.request.response_format";
  60. /**
  61. Deprecated, use @code gen_ai.request.seed @endcode.
  62. @deprecated
  63. {"note": "Replaced by @code gen_ai.request.seed @endcode.", "reason": "renamed", "renamed_to":
  64. "gen_ai.request.seed"}
  65. */
  66. OPENTELEMETRY_DEPRECATED static constexpr const char *kGenAiOpenaiRequestSeed =
  67. "gen_ai.openai.request.seed";
  68. /**
  69. The service tier requested. May be a specific tier, default, or auto.
  70. */
  71. static constexpr const char *kGenAiOpenaiRequestServiceTier = "gen_ai.openai.request.service_tier";
  72. /**
  73. The service tier used for the response.
  74. */
  75. static constexpr const char *kGenAiOpenaiResponseServiceTier =
  76. "gen_ai.openai.response.service_tier";
  77. /**
  78. A fingerprint to track any eventual change in the Generative AI environment.
  79. */
  80. static constexpr const char *kGenAiOpenaiResponseSystemFingerprint =
  81. "gen_ai.openai.response.system_fingerprint";
  82. /**
  83. The name of the operation being performed.
  84. <p>
  85. If one of the predefined values applies, but specific system uses a different name it's
  86. RECOMMENDED to document it in the semantic conventions for specific GenAI system and use
  87. system-specific name in the instrumentation. If a different name is not documented,
  88. instrumentation libraries SHOULD use applicable predefined value.
  89. */
  90. static constexpr const char *kGenAiOperationName = "gen_ai.operation.name";
  91. /**
  92. Represents the content type requested by the client.
  93. <p>
  94. This attribute SHOULD be used when the client requests output of a specific type. The model may
  95. return zero or more outputs of this type. This attribute specifies the output modality and not the
  96. actual output format. For example, if an image is requested, the actual output could be a URL
  97. pointing to an image file. Additional output format details may be recorded in the future in the
  98. @code gen_ai.output.{type}.* @endcode attributes.
  99. */
  100. static constexpr const char *kGenAiOutputType = "gen_ai.output.type";
  101. /**
  102. Deprecated, use Event API to report prompt contents.
  103. @deprecated
  104. {"note": "Removed, no replacement at this time.", "reason": "obsoleted"}
  105. */
  106. OPENTELEMETRY_DEPRECATED static constexpr const char *kGenAiPrompt = "gen_ai.prompt";
  107. /**
  108. The target number of candidate completions to return.
  109. */
  110. static constexpr const char *kGenAiRequestChoiceCount = "gen_ai.request.choice.count";
  111. /**
  112. The encoding formats requested in an embeddings operation, if specified.
  113. <p>
  114. In some GenAI systems the encoding formats are called embedding types. Also, some GenAI systems
  115. only accept a single format per request.
  116. */
  117. static constexpr const char *kGenAiRequestEncodingFormats = "gen_ai.request.encoding_formats";
  118. /**
  119. The frequency penalty setting for the GenAI request.
  120. */
  121. static constexpr const char *kGenAiRequestFrequencyPenalty = "gen_ai.request.frequency_penalty";
  122. /**
  123. The maximum number of tokens the model generates for a request.
  124. */
  125. static constexpr const char *kGenAiRequestMaxTokens = "gen_ai.request.max_tokens";
  126. /**
  127. The name of the GenAI model a request is being made to.
  128. */
  129. static constexpr const char *kGenAiRequestModel = "gen_ai.request.model";
  130. /**
  131. The presence penalty setting for the GenAI request.
  132. */
  133. static constexpr const char *kGenAiRequestPresencePenalty = "gen_ai.request.presence_penalty";
  134. /**
  135. Requests with same seed value more likely to return same result.
  136. */
  137. static constexpr const char *kGenAiRequestSeed = "gen_ai.request.seed";
  138. /**
  139. List of sequences that the model will use to stop generating further tokens.
  140. */
  141. static constexpr const char *kGenAiRequestStopSequences = "gen_ai.request.stop_sequences";
  142. /**
  143. The temperature setting for the GenAI request.
  144. */
  145. static constexpr const char *kGenAiRequestTemperature = "gen_ai.request.temperature";
  146. /**
  147. The top_k sampling setting for the GenAI request.
  148. */
  149. static constexpr const char *kGenAiRequestTopK = "gen_ai.request.top_k";
  150. /**
  151. The top_p sampling setting for the GenAI request.
  152. */
  153. static constexpr const char *kGenAiRequestTopP = "gen_ai.request.top_p";
  154. /**
  155. Array of reasons the model stopped generating tokens, corresponding to each generation received.
  156. */
  157. static constexpr const char *kGenAiResponseFinishReasons = "gen_ai.response.finish_reasons";
  158. /**
  159. The unique identifier for the completion.
  160. */
  161. static constexpr const char *kGenAiResponseId = "gen_ai.response.id";
  162. /**
  163. The name of the model that generated the response.
  164. */
  165. static constexpr const char *kGenAiResponseModel = "gen_ai.response.model";
  166. /**
  167. The Generative AI product as identified by the client or server instrumentation.
  168. <p>
  169. The @code gen_ai.system @endcode describes a family of GenAI models with specific model identified
  170. by @code gen_ai.request.model @endcode and @code gen_ai.response.model @endcode attributes.
  171. <p>
  172. The actual GenAI product may differ from the one identified by the client.
  173. Multiple systems, including Azure OpenAI and Gemini, are accessible by OpenAI client
  174. libraries. In such cases, the @code gen_ai.system @endcode is set to @code openai @endcode based
  175. on the instrumentation's best knowledge, instead of the actual system. The @code server.address
  176. @endcode attribute may help identify the actual system in use for @code openai @endcode. <p> For
  177. custom model, a custom friendly name SHOULD be used. If none of these options apply, the @code
  178. gen_ai.system @endcode SHOULD be set to @code _OTHER @endcode.
  179. */
  180. static constexpr const char *kGenAiSystem = "gen_ai.system";
  181. /**
  182. The type of token being counted.
  183. */
  184. static constexpr const char *kGenAiTokenType = "gen_ai.token.type";
  185. /**
  186. The tool call identifier.
  187. */
  188. static constexpr const char *kGenAiToolCallId = "gen_ai.tool.call.id";
  189. /**
  190. The tool description.
  191. */
  192. static constexpr const char *kGenAiToolDescription = "gen_ai.tool.description";
  193. /**
  194. Name of the tool utilized by the agent.
  195. */
  196. static constexpr const char *kGenAiToolName = "gen_ai.tool.name";
  197. /**
  198. Type of the tool utilized by the agent
  199. <p>
  200. Extension: A tool executed on the agent-side to directly call external APIs, bridging the gap
  201. between the agent and real-world systems. Agent-side operations involve actions that are performed
  202. by the agent on the server or within the agent's controlled environment. Function: A tool executed
  203. on the client-side, where the agent generates parameters for a predefined function, and the client
  204. executes the logic. Client-side operations are actions taken on the user's end or within the
  205. client application. Datastore: A tool used by the agent to access and query structured or
  206. unstructured external data for retrieval-augmented tasks or knowledge updates.
  207. */
  208. static constexpr const char *kGenAiToolType = "gen_ai.tool.type";
  209. /**
  210. Deprecated, use @code gen_ai.usage.output_tokens @endcode instead.
  211. @deprecated
  212. {"note": "Replaced by @code gen_ai.usage.output_tokens @endcode.", "reason": "renamed",
  213. "renamed_to": "gen_ai.usage.output_tokens"}
  214. */
  215. OPENTELEMETRY_DEPRECATED static constexpr const char *kGenAiUsageCompletionTokens =
  216. "gen_ai.usage.completion_tokens";
  217. /**
  218. The number of tokens used in the GenAI input (prompt).
  219. */
  220. static constexpr const char *kGenAiUsageInputTokens = "gen_ai.usage.input_tokens";
  221. /**
  222. The number of tokens used in the GenAI response (completion).
  223. */
  224. static constexpr const char *kGenAiUsageOutputTokens = "gen_ai.usage.output_tokens";
  225. /**
  226. Deprecated, use @code gen_ai.usage.input_tokens @endcode instead.
  227. @deprecated
  228. {"note": "Replaced by @code gen_ai.usage.input_tokens @endcode.", "reason": "renamed",
  229. "renamed_to": "gen_ai.usage.input_tokens"}
  230. */
  231. OPENTELEMETRY_DEPRECATED static constexpr const char *kGenAiUsagePromptTokens =
  232. "gen_ai.usage.prompt_tokens";
  233. namespace GenAiOpenaiRequestResponseFormatValues
  234. {
  235. /**
  236. Text response format
  237. */
  238. static constexpr const char *kText = "text";
  239. /**
  240. JSON object response format
  241. */
  242. static constexpr const char *kJsonObject = "json_object";
  243. /**
  244. JSON schema response format
  245. */
  246. static constexpr const char *kJsonSchema = "json_schema";
  247. } // namespace GenAiOpenaiRequestResponseFormatValues
  248. namespace GenAiOpenaiRequestServiceTierValues
  249. {
  250. /**
  251. The system will utilize scale tier credits until they are exhausted.
  252. */
  253. static constexpr const char *kAuto = "auto";
  254. /**
  255. The system will utilize the default scale tier.
  256. */
  257. static constexpr const char *kDefault = "default";
  258. } // namespace GenAiOpenaiRequestServiceTierValues
  259. namespace GenAiOperationNameValues
  260. {
  261. /**
  262. Chat completion operation such as <a
  263. href="https://platform.openai.com/docs/api-reference/chat">OpenAI Chat API</a>
  264. */
  265. static constexpr const char *kChat = "chat";
  266. /**
  267. Multimodal content generation operation such as <a
  268. href="https://ai.google.dev/api/generate-content">Gemini Generate Content</a>
  269. */
  270. static constexpr const char *kGenerateContent = "generate_content";
  271. /**
  272. Text completions operation such as <a
  273. href="https://platform.openai.com/docs/api-reference/completions">OpenAI Completions API
  274. (Legacy)</a>
  275. */
  276. static constexpr const char *kTextCompletion = "text_completion";
  277. /**
  278. Embeddings operation such as <a
  279. href="https://platform.openai.com/docs/api-reference/embeddings/create">OpenAI Create embeddings
  280. API</a>
  281. */
  282. static constexpr const char *kEmbeddings = "embeddings";
  283. /**
  284. Create GenAI agent
  285. */
  286. static constexpr const char *kCreateAgent = "create_agent";
  287. /**
  288. Invoke GenAI agent
  289. */
  290. static constexpr const char *kInvokeAgent = "invoke_agent";
  291. /**
  292. Execute a tool
  293. */
  294. static constexpr const char *kExecuteTool = "execute_tool";
  295. } // namespace GenAiOperationNameValues
  296. namespace GenAiOutputTypeValues
  297. {
  298. /**
  299. Plain text
  300. */
  301. static constexpr const char *kText = "text";
  302. /**
  303. JSON object with known or unknown schema
  304. */
  305. static constexpr const char *kJson = "json";
  306. /**
  307. Image
  308. */
  309. static constexpr const char *kImage = "image";
  310. /**
  311. Speech
  312. */
  313. static constexpr const char *kSpeech = "speech";
  314. } // namespace GenAiOutputTypeValues
  315. namespace GenAiSystemValues
  316. {
  317. /**
  318. OpenAI
  319. */
  320. static constexpr const char *kOpenai = "openai";
  321. /**
  322. Any Google generative AI endpoint
  323. */
  324. static constexpr const char *kGcpGenAi = "gcp.gen_ai";
  325. /**
  326. Vertex AI
  327. */
  328. static constexpr const char *kGcpVertexAi = "gcp.vertex_ai";
  329. /**
  330. Gemini
  331. */
  332. static constexpr const char *kGcpGemini = "gcp.gemini";
  333. /**
  334. Vertex AI
  335. */
  336. static constexpr const char *kVertexAi = "vertex_ai";
  337. /**
  338. Gemini
  339. */
  340. static constexpr const char *kGemini = "gemini";
  341. /**
  342. Anthropic
  343. */
  344. static constexpr const char *kAnthropic = "anthropic";
  345. /**
  346. Cohere
  347. */
  348. static constexpr const char *kCohere = "cohere";
  349. /**
  350. Azure AI Inference
  351. */
  352. static constexpr const char *kAzAiInference = "az.ai.inference";
  353. /**
  354. Azure OpenAI
  355. */
  356. static constexpr const char *kAzAiOpenai = "az.ai.openai";
  357. /**
  358. IBM Watsonx AI
  359. */
  360. static constexpr const char *kIbmWatsonxAi = "ibm.watsonx.ai";
  361. /**
  362. AWS Bedrock
  363. */
  364. static constexpr const char *kAwsBedrock = "aws.bedrock";
  365. /**
  366. Perplexity
  367. */
  368. static constexpr const char *kPerplexity = "perplexity";
  369. /**
  370. xAI
  371. */
  372. static constexpr const char *kXai = "xai";
  373. /**
  374. DeepSeek
  375. */
  376. static constexpr const char *kDeepseek = "deepseek";
  377. /**
  378. Groq
  379. */
  380. static constexpr const char *kGroq = "groq";
  381. /**
  382. Mistral AI
  383. */
  384. static constexpr const char *kMistralAi = "mistral_ai";
  385. } // namespace GenAiSystemValues
  386. namespace GenAiTokenTypeValues
  387. {
  388. /**
  389. Input tokens (prompt, input, etc.)
  390. */
  391. static constexpr const char *kInput = "input";
  392. /**
  393. Output tokens (completion, response, etc.)
  394. */
  395. static constexpr const char *kCompletion = "output";
  396. /**
  397. Output tokens (completion, response, etc.)
  398. */
  399. static constexpr const char *kOutput = "output";
  400. } // namespace GenAiTokenTypeValues
  401. } // namespace gen_ai
  402. } // namespace semconv
  403. OPENTELEMETRY_END_NAMESPACE