agento11y-gemini 0.10.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3 @@
1
+ SPDX-License-Identifier: Apache-2.0
2
+
3
+ See /LICENSE at repository root for full license text.
@@ -0,0 +1,127 @@
1
+ Metadata-Version: 2.4
2
+ Name: agento11y-gemini
3
+ Version: 0.10.0
4
+ Summary: Gemini helper wrappers for the Grafana Agent Observability Python SDK
5
+ License: SPDX-License-Identifier: Apache-2.0
6
+
7
+ See /LICENSE at repository root for full license text.
8
+
9
+ Requires-Python: >=3.10
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Requires-Dist: agento11y>=0.10.0
13
+ Requires-Dist: google-genai<2,>=1.63.0
14
+ Provides-Extra: dev
15
+ Requires-Dist: pytest>=9.0.3; extra == "dev"
16
+ Dynamic: license-file
17
+
18
+ # Sigil Python Provider Helper: Gemini
19
+
20
+ `agento11y-gemini` provides strict Gemini Models wrappers and mappers for Sigil.
21
+
22
+ ## Installation
23
+
24
+ ```bash
25
+ pip install agento11y agento11y-gemini google-genai
26
+ ```
27
+
28
+ ## Public API
29
+
30
+ - Wrappers:
31
+ - `models.generate_content(...)`
32
+ - `models.generate_content_async(...)`
33
+ - `models.generate_content_stream(...)`
34
+ - `models.generate_content_stream_async(...)`
35
+ - `models.embed_content(...)`
36
+ - `models.embed_content_async(...)`
37
+ - Mappers:
38
+ - `models.from_request_response(...)`
39
+ - `models.from_stream(...)`
40
+ - `models.embedding_from_response(...)`
41
+
42
+ ## Wrapper Mode (Sync)
43
+
44
+ ```python
45
+ from google.genai import types as genai_types
46
+ from agento11y import Client, ClientConfig
47
+ from agento11y_gemini import GeminiOptions, models
48
+
49
+ client = Client(ClientConfig())
50
+
51
+ model = "gemini-2.5-pro"
52
+ contents = [genai_types.Content(role="user", parts=[genai_types.Part(text="Hello")])]
53
+ config = genai_types.GenerateContentConfig(max_output_tokens=256)
54
+
55
+ response = models.generate_content(
56
+ client,
57
+ model,
58
+ contents,
59
+ config,
60
+ lambda req_model, req_contents, req_config: gemini_client.models.generate_content(
61
+ model=req_model,
62
+ contents=req_contents,
63
+ config=req_config,
64
+ ),
65
+ GeminiOptions(conversation_id="conv-1", agent_name="assistant", agent_version="1.0.0"),
66
+ )
67
+ ```
68
+
69
+ ## Wrapper Mode (Stream)
70
+
71
+ ```python
72
+ from agento11y_gemini import GeminiStreamSummary, models
73
+
74
+ summary = models.generate_content_stream(
75
+ client,
76
+ model,
77
+ contents,
78
+ config,
79
+ lambda req_model, req_contents, req_config: GeminiStreamSummary(
80
+ responses=list(gemini_client.models.generate_content_stream(
81
+ model=req_model,
82
+ contents=req_contents,
83
+ config=req_config,
84
+ ))
85
+ ),
86
+ )
87
+ ```
88
+
89
+ ## Mapper Mode
90
+
91
+ ```python
92
+ generation = models.from_request_response(model, contents, config, response)
93
+ stream_generation = models.from_stream(model, contents, config, summary)
94
+ ```
95
+
96
+ ## Embedding example
97
+
98
+ ```python
99
+ embedding_response = models.embed_content(
100
+ client,
101
+ "gemini-embedding-001",
102
+ contents,
103
+ None,
104
+ lambda req_model, req_contents, req_config: gemini_client.models.embed_content(
105
+ model=req_model,
106
+ contents=req_contents,
107
+ config=req_config,
108
+ ),
109
+ )
110
+ ```
111
+
112
+ ## Raw Provider Artifacts (Opt-In)
113
+
114
+ ```python
115
+ options = GeminiOptions(raw_artifacts=True)
116
+ ```
117
+
118
+ Raw artifacts are default OFF and should only be enabled for diagnostics.
119
+
120
+ ## Provider metadata mapping
121
+
122
+ Gemini-specific fields are mapped as follows:
123
+
124
+ - `usage.thoughts_token_count` -> normalized `usage.reasoning_tokens`
125
+ - `usage.tool_use_prompt_token_count` -> metadata `agento11y.gen_ai.usage.tool_use_prompt_tokens`
126
+ - `config.thinking_config.thinking_budget` -> metadata `agento11y.gen_ai.request.thinking.budget_tokens`
127
+ - `config.thinking_config.thinking_level` -> metadata `agento11y.gen_ai.request.thinking.level`
@@ -0,0 +1,110 @@
1
+ # Sigil Python Provider Helper: Gemini
2
+
3
+ `agento11y-gemini` provides strict Gemini Models wrappers and mappers for Sigil.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install agento11y agento11y-gemini google-genai
9
+ ```
10
+
11
+ ## Public API
12
+
13
+ - Wrappers:
14
+ - `models.generate_content(...)`
15
+ - `models.generate_content_async(...)`
16
+ - `models.generate_content_stream(...)`
17
+ - `models.generate_content_stream_async(...)`
18
+ - `models.embed_content(...)`
19
+ - `models.embed_content_async(...)`
20
+ - Mappers:
21
+ - `models.from_request_response(...)`
22
+ - `models.from_stream(...)`
23
+ - `models.embedding_from_response(...)`
24
+
25
+ ## Wrapper Mode (Sync)
26
+
27
+ ```python
28
+ from google.genai import types as genai_types
29
+ from agento11y import Client, ClientConfig
30
+ from agento11y_gemini import GeminiOptions, models
31
+
32
+ client = Client(ClientConfig())
33
+
34
+ model = "gemini-2.5-pro"
35
+ contents = [genai_types.Content(role="user", parts=[genai_types.Part(text="Hello")])]
36
+ config = genai_types.GenerateContentConfig(max_output_tokens=256)
37
+
38
+ response = models.generate_content(
39
+ client,
40
+ model,
41
+ contents,
42
+ config,
43
+ lambda req_model, req_contents, req_config: gemini_client.models.generate_content(
44
+ model=req_model,
45
+ contents=req_contents,
46
+ config=req_config,
47
+ ),
48
+ GeminiOptions(conversation_id="conv-1", agent_name="assistant", agent_version="1.0.0"),
49
+ )
50
+ ```
51
+
52
+ ## Wrapper Mode (Stream)
53
+
54
+ ```python
55
+ from agento11y_gemini import GeminiStreamSummary, models
56
+
57
+ summary = models.generate_content_stream(
58
+ client,
59
+ model,
60
+ contents,
61
+ config,
62
+ lambda req_model, req_contents, req_config: GeminiStreamSummary(
63
+ responses=list(gemini_client.models.generate_content_stream(
64
+ model=req_model,
65
+ contents=req_contents,
66
+ config=req_config,
67
+ ))
68
+ ),
69
+ )
70
+ ```
71
+
72
+ ## Mapper Mode
73
+
74
+ ```python
75
+ generation = models.from_request_response(model, contents, config, response)
76
+ stream_generation = models.from_stream(model, contents, config, summary)
77
+ ```
78
+
79
+ ## Embedding example
80
+
81
+ ```python
82
+ embedding_response = models.embed_content(
83
+ client,
84
+ "gemini-embedding-001",
85
+ contents,
86
+ None,
87
+ lambda req_model, req_contents, req_config: gemini_client.models.embed_content(
88
+ model=req_model,
89
+ contents=req_contents,
90
+ config=req_config,
91
+ ),
92
+ )
93
+ ```
94
+
95
+ ## Raw Provider Artifacts (Opt-In)
96
+
97
+ ```python
98
+ options = GeminiOptions(raw_artifacts=True)
99
+ ```
100
+
101
+ Raw artifacts are default OFF and should only be enabled for diagnostics.
102
+
103
+ ## Provider metadata mapping
104
+
105
+ Gemini-specific fields are mapped as follows:
106
+
107
+ - `usage.thoughts_token_count` -> normalized `usage.reasoning_tokens`
108
+ - `usage.tool_use_prompt_token_count` -> metadata `agento11y.gen_ai.usage.tool_use_prompt_tokens`
109
+ - `config.thinking_config.thinking_budget` -> metadata `agento11y.gen_ai.request.thinking.budget_tokens`
110
+ - `config.thinking_config.thinking_level` -> metadata `agento11y.gen_ai.request.thinking.level`
@@ -0,0 +1,13 @@
1
+ """Gemini strict wrapper namespace for Sigil Python SDK."""
2
+
3
+ from .provider import (
4
+ GeminiOptions,
5
+ GeminiStreamSummary,
6
+ models,
7
+ )
8
+
9
+ __all__ = [
10
+ "GeminiOptions",
11
+ "GeminiStreamSummary",
12
+ "models",
13
+ ]