adstractai 0.0.3__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,24 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.so
4
+ *.egg-info/
5
+ build/
6
+ dist/
7
+ .eggs/
8
+ .pytest_cache/
9
+ .ruff_cache/
10
+ .mypy_cache/
11
+ .pyright/
12
+ .venv/
13
+ venv/
14
+ env/
15
+ .env
16
+ .coverage
17
+ coverage.xml
18
+ .tox/
19
+ pip-wheel-metadata/
20
+ *.log
21
+ *.sqlite3
22
+ .DS_Store
23
+ .idea/
24
+ .vscode/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Adstract AI
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,173 @@
1
+ Metadata-Version: 2.4
2
+ Name: adstractai
3
+ Version: 0.0.3
4
+ Summary: Ad network that delivers ads to the LLM's response
5
+ Project-URL: Homepage, https://github.com/Adstract-AI/adstract-library
6
+ Project-URL: Repository, https://github.com/Adstract-AI/adstract-library
7
+ Project-URL: Issues, https://github.com/Adstract-AI/adstract-library/issues
8
+ Author-email: Nikola Jagurinoski <jagurinoskini@gmail.com>, Viktor Kostadinoski <kostadinoskiviktor@yahoo.com>, Andrea Stevanoska <andrea.stevanoska2@gmail.com>, Darko Petrushevski <petrusevskidare@gmail.com>, Gorazd Filpovski <gorazdfilipovski@gmail.com>
9
+ License: MIT
10
+ License-File: LICENSE
11
+ Keywords: ad-network,ad-serving,ads,llm
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3 :: Only
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Typing :: Typed
22
+ Requires-Python: >=3.10
23
+ Requires-Dist: httpx>=0.27.0
24
+ Requires-Dist: pydantic>=2.0.0
25
+ Provides-Extra: dev
26
+ Requires-Dist: build>=1.2.1; extra == 'dev'
27
+ Requires-Dist: pre-commit>=3.7.1; extra == 'dev'
28
+ Requires-Dist: pyright>=1.1.376; extra == 'dev'
29
+ Requires-Dist: pytest>=8.2.2; extra == 'dev'
30
+ Requires-Dist: ruff>=0.6.5; extra == 'dev'
31
+ Description-Content-Type: text/markdown
32
+
33
+ # Adstract AI Python SDK
34
+
35
+ ![CI](https://github.com/Adstract-AI/adstract-library/actions/workflows/ci.yml/badge.svg)
36
+ ![PyPI](https://img.shields.io/pypi/v/adstractai.svg)
37
+
38
+ Ad network SDK that delivers ads into LLM responses.
39
+
40
+ ## Install
41
+
42
+ ```bash
43
+ python -m pip install adstractai
44
+ ```
45
+
46
+ ## Quickstart
47
+
48
+ ```python
49
+ from adstractai import AdClient
50
+
51
+ client = AdClient(api_key="sk_test_1234567890")
52
+
53
+ response = client.request_ad(
54
+ prompt="How do I improve analytics in my LLM app?",
55
+ conversation={
56
+ "conversation_id": "conv-1",
57
+ "session_id": "sess-1",
58
+ "message_id": "msg-1",
59
+ },
60
+ user_agent=(
61
+ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 "
62
+ "(KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
63
+ ),
64
+ )
65
+
66
+ print(response.ads)
67
+ client.close()
68
+ ```
69
+
70
+ ## Authentication
71
+
72
+ Pass an API key when initializing the client or set `ADSTRACT_API_KEY`.
73
+
74
+ ```bash
75
+ export ADSTRACT_API_KEY="sk_test_1234567890"
76
+ ```
77
+
78
+ ```python
79
+ from adstractai import AdClient
80
+
81
+ client = AdClient()
82
+ ```
83
+
84
+ ## Advanced usage
85
+
86
+ ```python
87
+ from adstractai import AdClient
88
+
89
+ client = AdClient(api_key="sk_test_1234567890", retries=2)
90
+
91
+ response = client.request_ad(
92
+ prompt="Need performance tips",
93
+ conversation={
94
+ "conversation_id": "conv-42",
95
+ "session_id": "sess-42",
96
+ "message_id": "msg-42",
97
+ },
98
+ user_agent=(
99
+ "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 "
100
+ "(KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
101
+ ),
102
+ metadata={
103
+ "client": {
104
+ "referrer": "https://example.com",
105
+ }
106
+ },
107
+ constraints={
108
+ "max_ads": 2,
109
+ "safe_mode": "standard",
110
+ },
111
+ )
112
+
113
+ print(response.raw)
114
+ client.close()
115
+ ```
116
+
117
+ ## Async usage
118
+
119
+ ```python
120
+ import asyncio
121
+
122
+ from adstractai import AdClient
123
+
124
+
125
+ async def main() -> None:
126
+ client = AdClient(api_key="sk_test_1234567890")
127
+ response = await client.request_ad_async(
128
+ prompt="Need performance tips",
129
+ conversation={
130
+ "conversation_id": "conv-99",
131
+ "session_id": "sess-99",
132
+ "message_id": "msg-99",
133
+ },
134
+ user_agent=(
135
+ "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 "
136
+ "(KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
137
+ ),
138
+ )
139
+ print(response.ads)
140
+ await client.aclose()
141
+
142
+
143
+ asyncio.run(main())
144
+ ```
145
+
146
+ ## Development setup
147
+
148
+ ```bash
149
+ python -m venv .venv
150
+ source .venv/bin/activate
151
+ python -m pip install -e ".[dev]"
152
+ pre-commit install
153
+ ```
154
+
155
+ ## Scripts
156
+
157
+ ```bash
158
+ ruff format .
159
+ ruff check .
160
+ pyright
161
+ pytest
162
+ python -m build
163
+ ```
164
+
165
+ ## Release
166
+
167
+ 1. Bump the version in `pyproject.toml`.
168
+ 2. Update `CHANGELOG.md`.
169
+ 3. Commit the changes.
170
+ 4. Tag the release: `git tag vX.Y.Z`.
171
+ 5. Push commits and tags: `git push && git push --tags`.
172
+
173
+ Publishing to PyPI happens automatically via GitHub Actions using trusted publishing.
@@ -0,0 +1,141 @@
1
+ # Adstract AI Python SDK
2
+
3
+ ![CI](https://github.com/Adstract-AI/adstract-library/actions/workflows/ci.yml/badge.svg)
4
+ ![PyPI](https://img.shields.io/pypi/v/adstractai.svg)
5
+
6
+ Ad network SDK that delivers ads into LLM responses.
7
+
8
+ ## Install
9
+
10
+ ```bash
11
+ python -m pip install adstractai
12
+ ```
13
+
14
+ ## Quickstart
15
+
16
+ ```python
17
+ from adstractai import AdClient
18
+
19
+ client = AdClient(api_key="sk_test_1234567890")
20
+
21
+ response = client.request_ad(
22
+ prompt="How do I improve analytics in my LLM app?",
23
+ conversation={
24
+ "conversation_id": "conv-1",
25
+ "session_id": "sess-1",
26
+ "message_id": "msg-1",
27
+ },
28
+ user_agent=(
29
+ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 "
30
+ "(KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
31
+ ),
32
+ )
33
+
34
+ print(response.ads)
35
+ client.close()
36
+ ```
37
+
38
+ ## Authentication
39
+
40
+ Pass an API key when initializing the client or set `ADSTRACT_API_KEY`.
41
+
42
+ ```bash
43
+ export ADSTRACT_API_KEY="sk_test_1234567890"
44
+ ```
45
+
46
+ ```python
47
+ from adstractai import AdClient
48
+
49
+ client = AdClient()
50
+ ```
51
+
52
+ ## Advanced usage
53
+
54
+ ```python
55
+ from adstractai import AdClient
56
+
57
+ client = AdClient(api_key="sk_test_1234567890", retries=2)
58
+
59
+ response = client.request_ad(
60
+ prompt="Need performance tips",
61
+ conversation={
62
+ "conversation_id": "conv-42",
63
+ "session_id": "sess-42",
64
+ "message_id": "msg-42",
65
+ },
66
+ user_agent=(
67
+ "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 "
68
+ "(KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
69
+ ),
70
+ metadata={
71
+ "client": {
72
+ "referrer": "https://example.com",
73
+ }
74
+ },
75
+ constraints={
76
+ "max_ads": 2,
77
+ "safe_mode": "standard",
78
+ },
79
+ )
80
+
81
+ print(response.raw)
82
+ client.close()
83
+ ```
84
+
85
+ ## Async usage
86
+
87
+ ```python
88
+ import asyncio
89
+
90
+ from adstractai import AdClient
91
+
92
+
93
+ async def main() -> None:
94
+ client = AdClient(api_key="sk_test_1234567890")
95
+ response = await client.request_ad_async(
96
+ prompt="Need performance tips",
97
+ conversation={
98
+ "conversation_id": "conv-99",
99
+ "session_id": "sess-99",
100
+ "message_id": "msg-99",
101
+ },
102
+ user_agent=(
103
+ "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 "
104
+ "(KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
105
+ ),
106
+ )
107
+ print(response.ads)
108
+ await client.aclose()
109
+
110
+
111
+ asyncio.run(main())
112
+ ```
113
+
114
+ ## Development setup
115
+
116
+ ```bash
117
+ python -m venv .venv
118
+ source .venv/bin/activate
119
+ python -m pip install -e ".[dev]"
120
+ pre-commit install
121
+ ```
122
+
123
+ ## Scripts
124
+
125
+ ```bash
126
+ ruff format .
127
+ ruff check .
128
+ pyright
129
+ pytest
130
+ python -m build
131
+ ```
132
+
133
+ ## Release
134
+
135
+ 1. Bump the version in `pyproject.toml`.
136
+ 2. Update `CHANGELOG.md`.
137
+ 3. Commit the changes.
138
+ 4. Tag the release: `git tag vX.Y.Z`.
139
+ 5. Push commits and tags: `git push && git push --tags`.
140
+
141
+ Publishing to PyPI happens automatically via GitHub Actions using trusted publishing.
@@ -0,0 +1,75 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.21.0"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "adstractai"
7
+ version = "0.0.3"
8
+ description = "Ad network that delivers ads to the LLM's response"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = { text = "MIT" }
12
+ dependencies = [
13
+ "httpx>=0.27.0",
14
+ "pydantic>=2.0.0",
15
+ ]
16
+ authors = [
17
+ { name = "Nikola Jagurinoski", email = "jagurinoskini@gmail.com" },
18
+ { name = "Viktor Kostadinoski", email = "kostadinoskiviktor@yahoo.com" },
19
+ { name = "Andrea Stevanoska", email = "andrea.stevanoska2@gmail.com" },
20
+ { name = "Darko Petrushevski", email = "petrusevskidare@gmail.com" },
21
+ { name = "Gorazd Filpovski", email = "gorazdfilipovski@gmail.com" },
22
+ ]
23
+ classifiers = [
24
+ "Development Status :: 3 - Alpha",
25
+ "Intended Audience :: Developers",
26
+ "License :: OSI Approved :: MIT License",
27
+ "Programming Language :: Python",
28
+ "Programming Language :: Python :: 3",
29
+ "Programming Language :: Python :: 3.10",
30
+ "Programming Language :: Python :: 3.11",
31
+ "Programming Language :: Python :: 3.12",
32
+ "Programming Language :: Python :: 3 :: Only",
33
+ "Typing :: Typed",
34
+ ]
35
+ keywords = ["ads", "llm", "ad-network", "ad-serving"]
36
+
37
+ [project.urls]
38
+ Homepage = "https://github.com/Adstract-AI/adstract-library"
39
+ Repository = "https://github.com/Adstract-AI/adstract-library"
40
+ Issues = "https://github.com/Adstract-AI/adstract-library/issues"
41
+
42
+ [project.optional-dependencies]
43
+ dev = [
44
+ "build>=1.2.1",
45
+ "pre-commit>=3.7.1",
46
+ "pyright>=1.1.376",
47
+ "pytest>=8.2.2",
48
+ "ruff>=0.6.5",
49
+ ]
50
+
51
+ [tool.hatch.build.targets.wheel]
52
+ packages = ["src/adstractai"]
53
+
54
+ [tool.hatch.build]
55
+ include = ["src/adstractai/py.typed"]
56
+
57
+ [tool.pytest.ini_options]
58
+ testpaths = ["tests"]
59
+ addopts = "-ra"
60
+
61
+ [tool.pyright]
62
+ include = ["src", "tests"]
63
+ pythonVersion = "3.10"
64
+ typeCheckingMode = "basic"
65
+
66
+ [tool.ruff]
67
+ line-length = 100
68
+ target-version = "py310"
69
+
70
+ [tool.ruff.lint]
71
+ select = ["E", "F", "I", "B", "UP", "SIM", "PL"]
72
+ ignore = ["PLR0913", "PLR0917"]
73
+
74
+ [tool.ruff.format]
75
+ quote-style = "double"
File without changes