henergyqueai 0.1.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,37 @@
1
+ node_modules/
2
+ dist/
3
+ .env
4
+ .env.*
5
+ !.env.example
6
+ # Private keys, certificates and local credential stores.
7
+ *.pem
8
+ *.key
9
+ *.p12
10
+ *.pfx
11
+ *.crt
12
+ *.cer
13
+ *.der
14
+ *.csr
15
+ *.jks
16
+ *.keystore
17
+ id_rsa
18
+ id_dsa
19
+ id_ecdsa
20
+ id_ed25519
21
+ .ssh/
22
+ # Local databases and SQLite journal/WAL companions.
23
+ *.db
24
+ *.db-*
25
+ *.sqlite
26
+ *.sqlite-*
27
+ *.sqlite3
28
+ *.sqlite3-*
29
+ data/
30
+ test-results/
31
+ playwright-report/
32
+ *.log
33
+ artifacts/
34
+ output/
35
+ /CLAUDE CODE CLI/
36
+ .npmrc
37
+ **/.npmrc
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 HenergyqueAI
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,178 @@
1
+ Metadata-Version: 2.5
2
+ Name: henergyqueai
3
+ Version: 0.1.0
4
+ Summary: Bibliothèque officielle de l’API HenergyqueAI : Velys, Oryne et Aelyr depuis Python.
5
+ Project-URL: Homepage, https://henergyqueai.fr
6
+ Project-URL: Documentation, https://henergyqueai.fr/plateforme/docs#bibliotheques
7
+ License-Expression: MIT
8
+ License-File: LICENSE
9
+ Keywords: aelyr,api,henergyqueai,ia,oryne,velys
10
+ Classifier: Natural Language :: French
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Typing :: Typed
14
+ Requires-Python: >=3.9
15
+ Requires-Dist: httpx<1,>=0.25
16
+ Description-Content-Type: text/markdown
17
+
18
+ # henergyqueai
19
+
20
+ La bibliothèque officielle de l’API [HenergyqueAI](https://henergyqueai.fr) pour Python : Velys, Oryne et Aelyr en quelques lignes.
21
+
22
+ - Python 3.9+, une seule dépendance (httpx).
23
+ - Un client classique et un client asynchrone.
24
+ - Streaming, outils, images, sorties JSON.
25
+ - Nouvelles tentatives automatiques sur les erreurs passagères.
26
+
27
+ ```sh
28
+ pip install henergyqueai
29
+ ```
30
+
31
+ Créez une clé sur [henergyqueai.fr/plateforme/cles](https://henergyqueai.fr/plateforme/cles), puis :
32
+
33
+ ```sh
34
+ export HENERGYQUEAI_API_KEY="hak_…"
35
+ ```
36
+
37
+ ## Premier appel
38
+
39
+ ```python
40
+ from henergyqueai import HenergyqueAI
41
+
42
+ client = HenergyqueAI() # lit HENERGYQUEAI_API_KEY
43
+
44
+ print(client.ask("Donne-moi trois idées de prénom pour un chat."))
45
+ ```
46
+
47
+ `ask` utilise Velys par défaut :
48
+
49
+ ```python
50
+ client.ask("Relis cette fonction.", model="oryne", system="Réponds en une phrase.")
51
+ ```
52
+
53
+ ## Conversation complète
54
+
55
+ ```python
56
+ reponse = client.chat.create(
57
+ model="oryne",
58
+ messages=[
59
+ {"role": "system", "content": "Tu es un relecteur de code exigeant."},
60
+ {"role": "user", "content": "Que penses-tu de `for i in range(len(liste))` ?"},
61
+ ],
62
+ temperature=0.3,
63
+ )
64
+
65
+ print(reponse.text) # le texte, déjà extrait
66
+ print(reponse.usage.total_tokens)
67
+ ```
68
+
69
+ Les réponses sont des dictionnaires dont les clés se lisent aussi comme des attributs : `reponse.choices[0].message.content` ou `reponse["choices"][0]["message"]["content"]`.
70
+
71
+ ## Streaming
72
+
73
+ ```python
74
+ with client.chat.stream(
75
+ model="velys",
76
+ messages=[{"role": "user", "content": "Raconte une histoire courte."}],
77
+ ) as flux:
78
+ for texte in flux.text_stream:
79
+ print(texte, end="", flush=True)
80
+ finale = flux.final_completion()
81
+ ```
82
+
83
+ ## Client asynchrone
84
+
85
+ ```python
86
+ import asyncio
87
+ from henergyqueai import AsyncHenergyqueAI
88
+
89
+ async def main():
90
+ async with AsyncHenergyqueAI() as client:
91
+ print(await client.ask("Bonjour !"))
92
+ flux = client.chat.stream(model="velys", messages=[{"role": "user", "content": "Un haïku."}])
93
+ async for texte in flux.text_stream:
94
+ print(texte, end="", flush=True)
95
+
96
+ asyncio.run(main())
97
+ ```
98
+
99
+ ## Outils
100
+
101
+ ```python
102
+ import json
103
+
104
+ reponse = client.chat.create(
105
+ model="oryne",
106
+ messages=[{"role": "user", "content": "Quel temps fait-il à Nantes ?"}],
107
+ tools=[{
108
+ "type": "function",
109
+ "function": {
110
+ "name": "meteo",
111
+ "description": "La météo actuelle d’une ville",
112
+ "parameters": {"type": "object", "properties": {"ville": {"type": "string"}}, "required": ["ville"]},
113
+ },
114
+ }],
115
+ )
116
+
117
+ for appel in reponse.choices[0].message.get("tool_calls") or []:
118
+ ville = json.loads(appel.function.arguments)["ville"]
119
+ # … exécutez l’outil, puis renvoyez son résultat dans un message {"role": "tool", "tool_call_id": appel.id, "content": …}
120
+ ```
121
+
122
+ ## Format messages
123
+
124
+ ```python
125
+ message = client.messages.create(
126
+ model="aelyr",
127
+ system="Tu es précis et concis.",
128
+ messages=[{"role": "user", "content": "Explique la différence entre TCP et UDP."}],
129
+ )
130
+ print(message.text)
131
+
132
+ with client.messages.stream(model="aelyr", messages=[{"role": "user", "content": "Un haïku."}]) as flux:
133
+ for texte in flux.text_stream:
134
+ print(texte, end="")
135
+
136
+ client.messages.count_tokens(model="velys", messages=[{"role": "user", "content": "Bonjour"}]).input_tokens
137
+ ```
138
+
139
+ `max_tokens` vaut 1024 par défaut dans la bibliothèque.
140
+
141
+ ## Modèles et consommation
142
+
143
+ ```python
144
+ [modele.id for modele in client.models.list()] # ["velys", "oryne", "aelyr"]
145
+ client.models.retrieve("oryne")
146
+ client.usage().requests.remaining
147
+ ```
148
+
149
+ ## Erreurs
150
+
151
+ ```python
152
+ from henergyqueai import RateLimitError, AuthenticationError
153
+
154
+ try:
155
+ client.ask("Bonjour")
156
+ except RateLimitError as erreur:
157
+ print(f"Réessayez dans {erreur.retry_after} s.")
158
+ except AuthenticationError:
159
+ print("Clé invalide.")
160
+ ```
161
+
162
+ Chaque erreur porte `status`, `type`, `code`, `param`, `request_id` et `retry_after`. Les autres classes sont `InvalidRequestError`, `PermissionDeniedError`, `NotFoundError`, `ServerError`, `ConnectionError` et `TimeoutError`, toutes filles de `HenergyqueAIError`.
163
+
164
+ Les erreurs passagères (429, 5xx, coupure réseau) sont retentées deux fois, en respectant `retry-after`. La limite quotidienne de votre offre n’est jamais retentée.
165
+
166
+ ## Options
167
+
168
+ ```python
169
+ client = HenergyqueAI(
170
+ "hak_…", # sinon HENERGYQUEAI_API_KEY
171
+ timeout=60.0, # secondes (10 minutes par défaut)
172
+ max_retries=3, # 2 par défaut
173
+ )
174
+ ```
175
+
176
+ ## Licence
177
+
178
+ MIT
@@ -0,0 +1,161 @@
1
+ # henergyqueai
2
+
3
+ La bibliothèque officielle de l’API [HenergyqueAI](https://henergyqueai.fr) pour Python : Velys, Oryne et Aelyr en quelques lignes.
4
+
5
+ - Python 3.9+, une seule dépendance (httpx).
6
+ - Un client classique et un client asynchrone.
7
+ - Streaming, outils, images, sorties JSON.
8
+ - Nouvelles tentatives automatiques sur les erreurs passagères.
9
+
10
+ ```sh
11
+ pip install henergyqueai
12
+ ```
13
+
14
+ Créez une clé sur [henergyqueai.fr/plateforme/cles](https://henergyqueai.fr/plateforme/cles), puis :
15
+
16
+ ```sh
17
+ export HENERGYQUEAI_API_KEY="hak_…"
18
+ ```
19
+
20
+ ## Premier appel
21
+
22
+ ```python
23
+ from henergyqueai import HenergyqueAI
24
+
25
+ client = HenergyqueAI() # lit HENERGYQUEAI_API_KEY
26
+
27
+ print(client.ask("Donne-moi trois idées de prénom pour un chat."))
28
+ ```
29
+
30
+ `ask` utilise Velys par défaut :
31
+
32
+ ```python
33
+ client.ask("Relis cette fonction.", model="oryne", system="Réponds en une phrase.")
34
+ ```
35
+
36
+ ## Conversation complète
37
+
38
+ ```python
39
+ reponse = client.chat.create(
40
+ model="oryne",
41
+ messages=[
42
+ {"role": "system", "content": "Tu es un relecteur de code exigeant."},
43
+ {"role": "user", "content": "Que penses-tu de `for i in range(len(liste))` ?"},
44
+ ],
45
+ temperature=0.3,
46
+ )
47
+
48
+ print(reponse.text) # le texte, déjà extrait
49
+ print(reponse.usage.total_tokens)
50
+ ```
51
+
52
+ Les réponses sont des dictionnaires dont les clés se lisent aussi comme des attributs : `reponse.choices[0].message.content` ou `reponse["choices"][0]["message"]["content"]`.
53
+
54
+ ## Streaming
55
+
56
+ ```python
57
+ with client.chat.stream(
58
+ model="velys",
59
+ messages=[{"role": "user", "content": "Raconte une histoire courte."}],
60
+ ) as flux:
61
+ for texte in flux.text_stream:
62
+ print(texte, end="", flush=True)
63
+ finale = flux.final_completion()
64
+ ```
65
+
66
+ ## Client asynchrone
67
+
68
+ ```python
69
+ import asyncio
70
+ from henergyqueai import AsyncHenergyqueAI
71
+
72
+ async def main():
73
+ async with AsyncHenergyqueAI() as client:
74
+ print(await client.ask("Bonjour !"))
75
+ flux = client.chat.stream(model="velys", messages=[{"role": "user", "content": "Un haïku."}])
76
+ async for texte in flux.text_stream:
77
+ print(texte, end="", flush=True)
78
+
79
+ asyncio.run(main())
80
+ ```
81
+
82
+ ## Outils
83
+
84
+ ```python
85
+ import json
86
+
87
+ reponse = client.chat.create(
88
+ model="oryne",
89
+ messages=[{"role": "user", "content": "Quel temps fait-il à Nantes ?"}],
90
+ tools=[{
91
+ "type": "function",
92
+ "function": {
93
+ "name": "meteo",
94
+ "description": "La météo actuelle d’une ville",
95
+ "parameters": {"type": "object", "properties": {"ville": {"type": "string"}}, "required": ["ville"]},
96
+ },
97
+ }],
98
+ )
99
+
100
+ for appel in reponse.choices[0].message.get("tool_calls") or []:
101
+ ville = json.loads(appel.function.arguments)["ville"]
102
+ # … exécutez l’outil, puis renvoyez son résultat dans un message {"role": "tool", "tool_call_id": appel.id, "content": …}
103
+ ```
104
+
105
+ ## Format messages
106
+
107
+ ```python
108
+ message = client.messages.create(
109
+ model="aelyr",
110
+ system="Tu es précis et concis.",
111
+ messages=[{"role": "user", "content": "Explique la différence entre TCP et UDP."}],
112
+ )
113
+ print(message.text)
114
+
115
+ with client.messages.stream(model="aelyr", messages=[{"role": "user", "content": "Un haïku."}]) as flux:
116
+ for texte in flux.text_stream:
117
+ print(texte, end="")
118
+
119
+ client.messages.count_tokens(model="velys", messages=[{"role": "user", "content": "Bonjour"}]).input_tokens
120
+ ```
121
+
122
+ `max_tokens` vaut 1024 par défaut dans la bibliothèque.
123
+
124
+ ## Modèles et consommation
125
+
126
+ ```python
127
+ [modele.id for modele in client.models.list()] # ["velys", "oryne", "aelyr"]
128
+ client.models.retrieve("oryne")
129
+ client.usage().requests.remaining
130
+ ```
131
+
132
+ ## Erreurs
133
+
134
+ ```python
135
+ from henergyqueai import RateLimitError, AuthenticationError
136
+
137
+ try:
138
+ client.ask("Bonjour")
139
+ except RateLimitError as erreur:
140
+ print(f"Réessayez dans {erreur.retry_after} s.")
141
+ except AuthenticationError:
142
+ print("Clé invalide.")
143
+ ```
144
+
145
+ Chaque erreur porte `status`, `type`, `code`, `param`, `request_id` et `retry_after`. Les autres classes sont `InvalidRequestError`, `PermissionDeniedError`, `NotFoundError`, `ServerError`, `ConnectionError` et `TimeoutError`, toutes filles de `HenergyqueAIError`.
146
+
147
+ Les erreurs passagères (429, 5xx, coupure réseau) sont retentées deux fois, en respectant `retry-after`. La limite quotidienne de votre offre n’est jamais retentée.
148
+
149
+ ## Options
150
+
151
+ ```python
152
+ client = HenergyqueAI(
153
+ "hak_…", # sinon HENERGYQUEAI_API_KEY
154
+ timeout=60.0, # secondes (10 minutes par défaut)
155
+ max_retries=3, # 2 par défaut
156
+ )
157
+ ```
158
+
159
+ ## Licence
160
+
161
+ MIT
@@ -0,0 +1,27 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.21"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "henergyqueai"
7
+ version = "0.1.0"
8
+ description = "Bibliothèque officielle de l’API HenergyqueAI : Velys, Oryne et Aelyr depuis Python."
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ license-files = ["LICENSE"]
12
+ requires-python = ">=3.9"
13
+ dependencies = ["httpx>=0.25,<1"]
14
+ keywords = ["henergyqueai", "api", "ia", "velys", "oryne", "aelyr"]
15
+ classifiers = [
16
+ "Programming Language :: Python :: 3",
17
+ "Natural Language :: French",
18
+ "Typing :: Typed",
19
+ "Operating System :: OS Independent",
20
+ ]
21
+
22
+ [project.urls]
23
+ Homepage = "https://henergyqueai.fr"
24
+ Documentation = "https://henergyqueai.fr/plateforme/docs#bibliotheques"
25
+
26
+ [tool.hatch.build.targets.wheel]
27
+ packages = ["src/henergyqueai"]
@@ -0,0 +1,37 @@
1
+ """Bibliothèque officielle de l'API HenergyqueAI."""
2
+
3
+ from ._client import AsyncHenergyqueAI, HenergyqueAI
4
+ from ._errors import (
5
+ AuthenticationError,
6
+ ConnectionError,
7
+ HenergyqueAIError,
8
+ InvalidRequestError,
9
+ NotFoundError,
10
+ PermissionDeniedError,
11
+ RateLimitError,
12
+ ServerError,
13
+ TimeoutError,
14
+ )
15
+ from ._streaming import AsyncChatStream, AsyncMessageStream, ChatStream, MessageStream
16
+ from ._types import Result
17
+ from ._version import __version__
18
+
19
+ __all__ = [
20
+ "HenergyqueAI",
21
+ "AsyncHenergyqueAI",
22
+ "Result",
23
+ "ChatStream",
24
+ "MessageStream",
25
+ "AsyncChatStream",
26
+ "AsyncMessageStream",
27
+ "HenergyqueAIError",
28
+ "InvalidRequestError",
29
+ "AuthenticationError",
30
+ "PermissionDeniedError",
31
+ "NotFoundError",
32
+ "RateLimitError",
33
+ "ServerError",
34
+ "ConnectionError",
35
+ "TimeoutError",
36
+ "__version__",
37
+ ]