llmadapt 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.
llmadapt-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Your Name
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,112 @@
1
+ Metadata-Version: 2.4
2
+ Name: llmadapt
3
+ Version: 0.1.0
4
+ Summary: A lightweight, zero-dependency, provider-agnostic LLM agent with tool-calling support for Anthropic, OpenAI, Gemini, and Ollama.
5
+ Author-email: Shyam Parikh <shyamparikh@yahoo.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/Shyam-Parikh-2025/llmadapt
8
+ Project-URL: Issues, https://github.com/Shyam-Parikh-2025/llmadapt/issues
9
+ Keywords: llm,agent,tool-calling,anthropic,openai,gemini,ollama
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Requires-Python: >=3.9
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Dynamic: license-file
22
+
23
+ # llmadapt
24
+
25
+ A small, zero-dependency, provider-agnostic agent for chatting with LLMs and
26
+ giving them tools. Works with Anthropic, OpenAI, Gemini, and Ollama using only
27
+ the Python standard library for HTTP — no `requests`, no provider SDKs.
28
+ v0.1.0
29
+
30
+ ## Install
31
+
32
+ From source (until published to PyPI):
33
+
34
+ ```bash
35
+ git clone https://github.com/Shyam-Parikh-2025/llmadapt.git
36
+ cd llmadapt
37
+ pip install -e .
38
+ ```
39
+
40
+ Once published:
41
+
42
+ ```bash
43
+ pip install llmadapt
44
+ ```
45
+
46
+ ## Quick start
47
+
48
+ ```python
49
+ from llmadapt import Agent
50
+
51
+ agent = Agent(
52
+ provider="anthropic",
53
+ model="claude-sonnet-4-6",
54
+ api_key="sk-ant-...", # or set ANTHROPIC_API_KEY in your environment
55
+ system_instruction="You are a helpful assistant.",
56
+ )
57
+
58
+ print(agent.chat("What's 12 * 7?"))
59
+ ```
60
+
61
+ ## Giving the agent tools
62
+
63
+ ```python
64
+ def get_weather(city: str) -> dict:
65
+ """Look up the current weather for a city."""
66
+ return {"city": city, "tempF": 72, "condition": "sunny"}
67
+
68
+ agent.add_tool(get_weather)
69
+ print(agent.chat("What's the weather in NYC?"))
70
+ ```
71
+
72
+ A JSON schema is auto-generated from the function's type hints, default
73
+ values, and docstring. Tool outputs are JSON-serialized automatically
74
+ (plain strings pass through untouched).
75
+
76
+ ## Switching providers
77
+
78
+ ```python
79
+ agent.switch_api(provider="openai", model="gpt-4o", api_key="sk-...")
80
+ ```
81
+
82
+ ## Limiting tool-call loops
83
+
84
+ ```python
85
+ agent.set_max_tool_iterations(20) # default is 10
86
+ ```
87
+
88
+ If the model gets stuck calling tools repeatedly without producing a final
89
+ answer, `chat()` raises a `RuntimeError` instead of looping forever.
90
+
91
+ ## Supported providers
92
+
93
+ | provider | env var for API key | notes |
94
+ |-------------|------------------------|--------------------------------|
95
+ | `anthropic` | `ANTHROPIC_API_KEY` | Messages API |
96
+ | `openai` | `OPENAI_API_KEY` | Chat Completions API |
97
+ | `gemini` | `GEMINI_API_KEY` | generateContent endpoint |
98
+ | `ollama` | *(none — local)* | defaults to `localhost:11434` |
99
+ | `custom` | *(none — pass directly)* | requires `base_url` + a `custom_format_func` you supply to `chat()` |
100
+
101
+ ## Running tests
102
+
103
+ ```bash
104
+ python tests/test_agent.py
105
+ ```
106
+
107
+ Tests run entirely offline against scripted fake HTTP responses — no API key
108
+ or network access required.
109
+
110
+ ## License
111
+
112
+ MIT
@@ -0,0 +1,90 @@
1
+ # llmadapt
2
+
3
+ A small, zero-dependency, provider-agnostic agent for chatting with LLMs and
4
+ giving them tools. Works with Anthropic, OpenAI, Gemini, and Ollama using only
5
+ the Python standard library for HTTP — no `requests`, no provider SDKs.
6
+ v0.1.0
7
+
8
+ ## Install
9
+
10
+ From source (until published to PyPI):
11
+
12
+ ```bash
13
+ git clone https://github.com/Shyam-Parikh-2025/llmadapt.git
14
+ cd llmadapt
15
+ pip install -e .
16
+ ```
17
+
18
+ Once published:
19
+
20
+ ```bash
21
+ pip install llmadapt
22
+ ```
23
+
24
+ ## Quick start
25
+
26
+ ```python
27
+ from llmadapt import Agent
28
+
29
+ agent = Agent(
30
+ provider="anthropic",
31
+ model="claude-sonnet-4-6",
32
+ api_key="sk-ant-...", # or set ANTHROPIC_API_KEY in your environment
33
+ system_instruction="You are a helpful assistant.",
34
+ )
35
+
36
+ print(agent.chat("What's 12 * 7?"))
37
+ ```
38
+
39
+ ## Giving the agent tools
40
+
41
+ ```python
42
+ def get_weather(city: str) -> dict:
43
+ """Look up the current weather for a city."""
44
+ return {"city": city, "tempF": 72, "condition": "sunny"}
45
+
46
+ agent.add_tool(get_weather)
47
+ print(agent.chat("What's the weather in NYC?"))
48
+ ```
49
+
50
+ A JSON schema is auto-generated from the function's type hints, default
51
+ values, and docstring. Tool outputs are JSON-serialized automatically
52
+ (plain strings pass through untouched).
53
+
54
+ ## Switching providers
55
+
56
+ ```python
57
+ agent.switch_api(provider="openai", model="gpt-4o", api_key="sk-...")
58
+ ```
59
+
60
+ ## Limiting tool-call loops
61
+
62
+ ```python
63
+ agent.set_max_tool_iterations(20) # default is 10
64
+ ```
65
+
66
+ If the model gets stuck calling tools repeatedly without producing a final
67
+ answer, `chat()` raises a `RuntimeError` instead of looping forever.
68
+
69
+ ## Supported providers
70
+
71
+ | provider | env var for API key | notes |
72
+ |-------------|------------------------|--------------------------------|
73
+ | `anthropic` | `ANTHROPIC_API_KEY` | Messages API |
74
+ | `openai` | `OPENAI_API_KEY` | Chat Completions API |
75
+ | `gemini` | `GEMINI_API_KEY` | generateContent endpoint |
76
+ | `ollama` | *(none — local)* | defaults to `localhost:11434` |
77
+ | `custom` | *(none — pass directly)* | requires `base_url` + a `custom_format_func` you supply to `chat()` |
78
+
79
+ ## Running tests
80
+
81
+ ```bash
82
+ python tests/test_agent.py
83
+ ```
84
+
85
+ Tests run entirely offline against scripted fake HTTP responses — no API key
86
+ or network access required.
87
+
88
+ ## License
89
+
90
+ MIT
@@ -0,0 +1,33 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "llmadapt"
7
+ version = "0.1.0"
8
+ description = "A lightweight, zero-dependency, provider-agnostic LLM agent with tool-calling support for Anthropic, OpenAI, Gemini, and Ollama."
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ license = { text = "MIT" }
12
+ authors = [
13
+ { name = "Shyam Parikh", email = "shyamparikh@yahoo.com" }
14
+ ]
15
+ keywords = ["llm", "agent", "tool-calling", "anthropic", "openai", "gemini", "ollama"]
16
+ classifiers = [
17
+ "Development Status :: 3 - Alpha",
18
+ "Intended Audience :: Developers",
19
+ "License :: OSI Approved :: MIT License",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.9",
22
+ "Programming Language :: Python :: 3.10",
23
+ "Programming Language :: Python :: 3.11",
24
+ "Programming Language :: Python :: 3.12",
25
+ ]
26
+ dependencies = []
27
+
28
+ [project.urls]
29
+ Homepage = "https://github.com/Shyam-Parikh-2025/llmadapt"
30
+ Issues = "https://github.com/Shyam-Parikh-2025/llmadapt/issues"
31
+
32
+ [tool.setuptools.packages.find]
33
+ where = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,4 @@
1
+ from .core import Agent, Conversation, ToolRegistry
2
+
3
+ __all__ = ["Agent", "Conversation", "ToolRegistry"]
4
+ __version__ = "0.1.0"