Skip to content

Commit 5126f2a

Browse files
Copilothiyouga
andcommitted
feat: initialize agent adapter python and typescript packages
Co-authored-by: hiyouga <16256802+hiyouga@users.noreply.github.com>
1 parent f0f203d commit 5126f2a

13 files changed

Lines changed: 90 additions & 115 deletions

File tree

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,15 @@ cython_debug/
191191
# Ruff stuff:
192192
.ruff_cache/
193193

194+
# Node.js
195+
node_modules/
196+
dist/
197+
*.tsbuildinfo
198+
npm-debug.log*
199+
yarn-debug.log*
200+
yarn-error.log*
201+
pnpm-debug.log*
202+
194203
# PyPI configuration file
195204
.pypirc
196205

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ style:
2121
uv run ruff format $(check_dirs)
2222

2323
test:
24-
uv pip install -e .[tests]
24+
uv pip install -e .[dev]
2525
uv run pytest -vvv tests

README.md

Lines changed: 17 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,30 @@
1-
# Python Template
1+
# Agent Adapter
22

3-
A template for Python projects.
3+
This repository contains a minimal Python package and a minimal TypeScript package for the Agent Adapter hello world examples.
44

5-
## 1. Install uv project manager
5+
## Python package
66

7-
```bash
8-
curl -LsSf https://astral.sh/uv/install.sh | sh
9-
```
10-
11-
Follow https://docs.astral.sh/uv/ to install uv project manager on other operating systems.
12-
13-
## 2. Change the project name
14-
15-
Replace all occurrences of `custom_proj` with your new project name.
16-
17-
```
18-
custom_proj/
19-
├── __init__.py
20-
├── hello_world.py
21-
└── openrouter.py
22-
23-
# change to
24-
25-
new_name/
26-
├── __init__.py
27-
├── hello_world.py
28-
└── openrouter.py
29-
```
30-
31-
And pyproject.toml:
32-
33-
```toml
34-
name = "custom-proj"
35-
36-
# change to
37-
38-
name = "new-name"
39-
```
40-
41-
## 3. Run the example
7+
Install dependencies and run the example:
428

439
```bash
44-
make
45-
uv run python examples/invoke.py
10+
uv pip install -e .
11+
uv run python -m agent_adapter.hello_world
4612
```
4713

48-
## 4. Run the tests
14+
Run linting/tests:
4915

5016
```bash
17+
make quality
5118
make test
5219
```
5320

54-
## 5. Push to GitHub
21+
## TypeScript package
22+
23+
From the `typescript` directory:
5524

56-
See [CONTRIBUTING.md](CONTRIBUTING.md) for more details.
25+
```bash
26+
npm install
27+
npm run lint
28+
npm run build
29+
npm run start
30+
```
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,8 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14+
15+
from .hello_world import get_message, print_hello_world
16+
17+
18+
__all__ = ["get_message", "print_hello_world"]
Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,13 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
import datetime
1615

16+
def get_message() -> str:
17+
return "Hello from Agent Adapter!"
1718

18-
def get_current_time() -> str:
19-
return datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
2019

21-
22-
def print_hello_world():
23-
print(f"Hello from custom project! Current time is {get_current_time()}")
20+
def print_hello_world() -> None:
21+
print(get_message())
2422

2523

2624
if __name__ == "__main__":

custom_proj/openrouter.py

Lines changed: 0 additions & 36 deletions
This file was deleted.

pyproject.toml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
[project]
2-
name = "custom-proj"
2+
name = "agent-adapter"
33
version = "0.1.0"
4-
description = "Add your description here"
4+
description = "Agent Adapter Python package"
55
readme = "README.md"
66
requires-python = ">=3.11"
7-
dependencies = [
8-
"openai>=2.7.0",
9-
"python-dotenv>=1.2.1",
10-
]
7+
dependencies = []
118

129
[dependency-groups]
1310
dev = [
@@ -38,7 +35,6 @@ select = ["C", "E", "F", "I", "W", "RUF022"]
3835

3936
[tool.ruff.lint.isort]
4037
lines-after-imports = 2
41-
known-third-party = ["openai"]
4238

4339
[tool.ruff.format]
4440
quote-style = "double"
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from custom_proj.hello_world import print_hello_world
15+
from agent_adapter.hello_world import get_message
1616

1717

18-
if __name__ == "__main__":
19-
print_hello_world()
18+
def test_get_message():
19+
assert get_message() == "Hello from Agent Adapter!"

tests/test_openrouter.py

Lines changed: 0 additions & 19 deletions
This file was deleted.

typescript/.eslintrc.cjs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module.exports = {
2+
root: true,
3+
parser: "@typescript-eslint/parser",
4+
plugins: ["@typescript-eslint"],
5+
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
6+
env: {
7+
es2021: true,
8+
node: true,
9+
},
10+
ignorePatterns: ["dist/"],
11+
};

0 commit comments

Comments
 (0)