aixtools 0.1.0__py3-none-any.whl → 0.1.1__py3-none-any.whl
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.
Potentially problematic release.
This version of aixtools might be problematic. Click here for more details.
- aixtools/.chainlit/config.toml +113 -0
- aixtools/.chainlit/translations/bn.json +214 -0
- aixtools/.chainlit/translations/en-US.json +214 -0
- aixtools/.chainlit/translations/gu.json +214 -0
- aixtools/.chainlit/translations/he-IL.json +214 -0
- aixtools/.chainlit/translations/hi.json +214 -0
- aixtools/.chainlit/translations/ja.json +214 -0
- aixtools/.chainlit/translations/kn.json +214 -0
- aixtools/.chainlit/translations/ml.json +214 -0
- aixtools/.chainlit/translations/mr.json +214 -0
- aixtools/.chainlit/translations/nl.json +214 -0
- aixtools/.chainlit/translations/ta.json +214 -0
- aixtools/.chainlit/translations/te.json +214 -0
- aixtools/.chainlit/translations/zh-CN.json +214 -0
- aixtools/__init__.py +7 -1
- aixtools/_version.py +34 -0
- aixtools/chainlit.md +14 -0
- {aixtools-0.1.0.dist-info → aixtools-0.1.1.dist-info}/METADATA +1 -1
- {aixtools-0.1.0.dist-info → aixtools-0.1.1.dist-info}/RECORD +33 -6
- aixtools-0.1.1.dist-info/top_level.txt +4 -0
- docker/mcp-base/Dockerfile +36 -0
- notebooks/example_faulty_mcp_server.ipynb +74 -0
- notebooks/example_mcp_server_stdio.ipynb +76 -0
- notebooks/example_raw_mcp_client.ipynb +84 -0
- notebooks/example_tool_doctor.ipynb +65 -0
- scripts/config.sh +28 -0
- scripts/lint.sh +32 -0
- scripts/log_view.sh +18 -0
- scripts/run_example_mcp_server.sh +14 -0
- scripts/run_faulty_mcp_server.sh +13 -0
- scripts/run_server.sh +29 -0
- aixtools-0.1.0.dist-info/top_level.txt +0 -1
- {aixtools-0.1.0.dist-info → aixtools-0.1.1.dist-info}/WHEEL +0 -0
- {aixtools-0.1.0.dist-info → aixtools-0.1.1.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cells": [
|
|
3
|
+
{
|
|
4
|
+
"cell_type": "markdown",
|
|
5
|
+
"id": "57d36f62",
|
|
6
|
+
"metadata": {},
|
|
7
|
+
"source": [
|
|
8
|
+
"# Example \"Faulty MCP Server\"\n",
|
|
9
|
+
"\n",
|
|
10
|
+
"Run the server using the script:\n",
|
|
11
|
+
"\n",
|
|
12
|
+
"```bash\n",
|
|
13
|
+
"./scripts/run_faulty_mcp_server.sh\n",
|
|
14
|
+
"``` "
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"cell_type": "code",
|
|
19
|
+
"execution_count": null,
|
|
20
|
+
"id": "ebf6d915",
|
|
21
|
+
"metadata": {},
|
|
22
|
+
"outputs": [],
|
|
23
|
+
"source": [
|
|
24
|
+
"from aixtools.agents.agent import get_agent, run_agent\n",
|
|
25
|
+
"from pydantic_ai.mcp import MCPServerStreamableHTTP"
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"cell_type": "code",
|
|
30
|
+
"execution_count": null,
|
|
31
|
+
"id": "97d1e607",
|
|
32
|
+
"metadata": {},
|
|
33
|
+
"outputs": [],
|
|
34
|
+
"source": [
|
|
35
|
+
"server = MCPServerStreamableHTTP(\"http://localhost:9999/mcp/\")\n",
|
|
36
|
+
"agent = get_agent(mcp_servers=[server])"
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"cell_type": "code",
|
|
41
|
+
"execution_count": null,
|
|
42
|
+
"id": "fc560d25",
|
|
43
|
+
"metadata": {},
|
|
44
|
+
"outputs": [],
|
|
45
|
+
"source": [
|
|
46
|
+
"async with agent:\n",
|
|
47
|
+
" # ret = await run_agent(agent, \"What is the add of 40123456789 and 2123456789?\", verbose=True, debug=True)\n",
|
|
48
|
+
" # ret = await run_agent(agent, \"Invoke the always_error tool\", verbose=True, debug=True)\n",
|
|
49
|
+
" ret = await run_agent(agent, \"Invoke the throw_404_exception tool\", verbose=True, debug=True)"
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
"metadata": {
|
|
54
|
+
"kernelspec": {
|
|
55
|
+
"display_name": ".venv",
|
|
56
|
+
"language": "python",
|
|
57
|
+
"name": "python3"
|
|
58
|
+
},
|
|
59
|
+
"language_info": {
|
|
60
|
+
"codemirror_mode": {
|
|
61
|
+
"name": "ipython",
|
|
62
|
+
"version": 3
|
|
63
|
+
},
|
|
64
|
+
"file_extension": ".py",
|
|
65
|
+
"mimetype": "text/x-python",
|
|
66
|
+
"name": "python",
|
|
67
|
+
"nbconvert_exporter": "python",
|
|
68
|
+
"pygments_lexer": "ipython3",
|
|
69
|
+
"version": "3.12.2"
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"nbformat": 4,
|
|
73
|
+
"nbformat_minor": 5
|
|
74
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cells": [
|
|
3
|
+
{
|
|
4
|
+
"cell_type": "markdown",
|
|
5
|
+
"id": "57d36f62",
|
|
6
|
+
"metadata": {},
|
|
7
|
+
"source": [
|
|
8
|
+
"# Example MCP Server STDIO"
|
|
9
|
+
]
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"cell_type": "code",
|
|
13
|
+
"execution_count": null,
|
|
14
|
+
"id": "ebf6d915",
|
|
15
|
+
"metadata": {},
|
|
16
|
+
"outputs": [],
|
|
17
|
+
"source": [
|
|
18
|
+
"from aixtools.agents.agent import get_agent, run_agent\n",
|
|
19
|
+
"from aixtools.utils.config import PROJECT_DIR\n",
|
|
20
|
+
"from pydantic_ai.mcp import MCPServerStdio"
|
|
21
|
+
]
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"cell_type": "code",
|
|
25
|
+
"execution_count": null,
|
|
26
|
+
"id": "97d1e607",
|
|
27
|
+
"metadata": {},
|
|
28
|
+
"outputs": [],
|
|
29
|
+
"source": [
|
|
30
|
+
"mcp_path = PROJECT_DIR /'aixtools' / 'mcp' / 'example_server.py'\n",
|
|
31
|
+
"server = MCPServerStdio(command='fastmcp', args=['run', str(mcp_path)])\n",
|
|
32
|
+
"agent = get_agent(mcp_servers=[server])"
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"cell_type": "code",
|
|
37
|
+
"execution_count": null,
|
|
38
|
+
"id": "fc560d25",
|
|
39
|
+
"metadata": {},
|
|
40
|
+
"outputs": [],
|
|
41
|
+
"source": [
|
|
42
|
+
"async with agent:\n",
|
|
43
|
+
" ret = await run_agent(agent, \"What is the add of 40123456789 and 2123456789?\", verbose=True, debug=True)"
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"cell_type": "code",
|
|
48
|
+
"execution_count": null,
|
|
49
|
+
"id": "cad32e85",
|
|
50
|
+
"metadata": {},
|
|
51
|
+
"outputs": [],
|
|
52
|
+
"source": []
|
|
53
|
+
}
|
|
54
|
+
],
|
|
55
|
+
"metadata": {
|
|
56
|
+
"kernelspec": {
|
|
57
|
+
"display_name": ".venv",
|
|
58
|
+
"language": "python",
|
|
59
|
+
"name": "python3"
|
|
60
|
+
},
|
|
61
|
+
"language_info": {
|
|
62
|
+
"codemirror_mode": {
|
|
63
|
+
"name": "ipython",
|
|
64
|
+
"version": 3
|
|
65
|
+
},
|
|
66
|
+
"file_extension": ".py",
|
|
67
|
+
"mimetype": "text/x-python",
|
|
68
|
+
"name": "python",
|
|
69
|
+
"nbconvert_exporter": "python",
|
|
70
|
+
"pygments_lexer": "ipython3",
|
|
71
|
+
"version": "3.12.2"
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"nbformat": 4,
|
|
75
|
+
"nbformat_minor": 5
|
|
76
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cells": [
|
|
3
|
+
{
|
|
4
|
+
"cell_type": "markdown",
|
|
5
|
+
"id": "57d36f62",
|
|
6
|
+
"metadata": {},
|
|
7
|
+
"source": [
|
|
8
|
+
"# Example \"Raw MCP Client\"\n",
|
|
9
|
+
"\n",
|
|
10
|
+
"Run the server using the script:\n",
|
|
11
|
+
"\n",
|
|
12
|
+
"```bash\n",
|
|
13
|
+
"./scripts/run_faulty_mcp_server.sh\n",
|
|
14
|
+
"``` "
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"cell_type": "code",
|
|
19
|
+
"execution_count": null,
|
|
20
|
+
"id": "cad32e85",
|
|
21
|
+
"metadata": {},
|
|
22
|
+
"outputs": [],
|
|
23
|
+
"source": [
|
|
24
|
+
"from fastmcp import Client\n",
|
|
25
|
+
"import rich\n",
|
|
26
|
+
"\n",
|
|
27
|
+
"client = Client(\"http://localhost:9999/mcp/\")"
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"cell_type": "code",
|
|
32
|
+
"execution_count": null,
|
|
33
|
+
"id": "e372fc6a",
|
|
34
|
+
"metadata": {},
|
|
35
|
+
"outputs": [],
|
|
36
|
+
"source": [
|
|
37
|
+
"async with client:\n",
|
|
38
|
+
" # Basic server interaction\n",
|
|
39
|
+
" await client.ping()\n",
|
|
40
|
+
" \n",
|
|
41
|
+
" # # List available operations\n",
|
|
42
|
+
" # tools = await client.list_tools()\n",
|
|
43
|
+
" # rich.print(tools)\n",
|
|
44
|
+
" # \n",
|
|
45
|
+
" # # Execute 'add' tool\n",
|
|
46
|
+
" # result = await client.call_tool(\"add\", {\"a\": 7, \"b\": 3})\n",
|
|
47
|
+
" # rich.print(result)\n",
|
|
48
|
+
"\n",
|
|
49
|
+
" # Execute 'add' tool\n",
|
|
50
|
+
" result = await client.call_tool(\"throw_404_exception\", {})\n",
|
|
51
|
+
" rich.print(result)\n"
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"cell_type": "code",
|
|
56
|
+
"execution_count": null,
|
|
57
|
+
"id": "a8a743e2",
|
|
58
|
+
"metadata": {},
|
|
59
|
+
"outputs": [],
|
|
60
|
+
"source": []
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
"metadata": {
|
|
64
|
+
"kernelspec": {
|
|
65
|
+
"display_name": ".venv",
|
|
66
|
+
"language": "python",
|
|
67
|
+
"name": "python3"
|
|
68
|
+
},
|
|
69
|
+
"language_info": {
|
|
70
|
+
"codemirror_mode": {
|
|
71
|
+
"name": "ipython",
|
|
72
|
+
"version": 3
|
|
73
|
+
},
|
|
74
|
+
"file_extension": ".py",
|
|
75
|
+
"mimetype": "text/x-python",
|
|
76
|
+
"name": "python",
|
|
77
|
+
"nbconvert_exporter": "python",
|
|
78
|
+
"pygments_lexer": "ipython3",
|
|
79
|
+
"version": "3.12.2"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
"nbformat": 4,
|
|
83
|
+
"nbformat_minor": 5
|
|
84
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cells": [
|
|
3
|
+
{
|
|
4
|
+
"cell_type": "markdown",
|
|
5
|
+
"id": "dab47237",
|
|
6
|
+
"metadata": {},
|
|
7
|
+
"source": [
|
|
8
|
+
"# Tool doctor example"
|
|
9
|
+
]
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"cell_type": "code",
|
|
13
|
+
"execution_count": null,
|
|
14
|
+
"id": "9735e38c",
|
|
15
|
+
"metadata": {},
|
|
16
|
+
"outputs": [],
|
|
17
|
+
"source": [
|
|
18
|
+
"# Example 1: A reasonably well-defined tool\n",
|
|
19
|
+
"from aixtools.tools.doctor import tool_doctor\n",
|
|
20
|
+
"\n",
|
|
21
|
+
"\n",
|
|
22
|
+
"def add(a: int, b: int) -> int:\n",
|
|
23
|
+
" \"\"\" Add two numbers \"\"\"\n",
|
|
24
|
+
" return a + b\n",
|
|
25
|
+
"\n",
|
|
26
|
+
"# Example 2: A poorly defined tool\n",
|
|
27
|
+
"def z(a: int, b: int) -> int:\n",
|
|
28
|
+
" \"\"\" performs some arithmentic with two parameters \"\"\"\n",
|
|
29
|
+
" return a + b\n"
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"cell_type": "code",
|
|
34
|
+
"execution_count": null,
|
|
35
|
+
"id": "e50d48d6",
|
|
36
|
+
"metadata": {},
|
|
37
|
+
"outputs": [],
|
|
38
|
+
"source": [
|
|
39
|
+
"# Call tool doctor\n",
|
|
40
|
+
"ret = await tool_doctor([add, z])"
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
"metadata": {
|
|
45
|
+
"kernelspec": {
|
|
46
|
+
"display_name": ".venv",
|
|
47
|
+
"language": "python",
|
|
48
|
+
"name": "python3"
|
|
49
|
+
},
|
|
50
|
+
"language_info": {
|
|
51
|
+
"codemirror_mode": {
|
|
52
|
+
"name": "ipython",
|
|
53
|
+
"version": 3
|
|
54
|
+
},
|
|
55
|
+
"file_extension": ".py",
|
|
56
|
+
"mimetype": "text/x-python",
|
|
57
|
+
"name": "python",
|
|
58
|
+
"nbconvert_exporter": "python",
|
|
59
|
+
"pygments_lexer": "ipython3",
|
|
60
|
+
"version": "3.12.2"
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"nbformat": 4,
|
|
64
|
+
"nbformat_minor": 5
|
|
65
|
+
}
|
scripts/config.sh
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#-----------------------------------------------------------------------------
|
|
2
|
+
#
|
|
3
|
+
# This template script sets up the environment for the project by defining the
|
|
4
|
+
# project directory and activating the virtual environment.
|
|
5
|
+
#
|
|
6
|
+
#-----------------------------------------------------------------------------
|
|
7
|
+
|
|
8
|
+
export SCRIPTS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
9
|
+
|
|
10
|
+
# Project directory
|
|
11
|
+
export PROJECT_DIR="$( cd $SCRIPTS_DIR/.. && pwd -P )"
|
|
12
|
+
export PROJECT_NAME="$(basename $PROJECT_DIR)"
|
|
13
|
+
|
|
14
|
+
# Data directories
|
|
15
|
+
export DATA_DIR="$PROJECT_DIR/data"
|
|
16
|
+
export LOGS_DIR="$PROJECT_DIR/logs"
|
|
17
|
+
export PG_DATA_DIR="$DATA_DIR/data/db/postgres"
|
|
18
|
+
|
|
19
|
+
# Server configuration
|
|
20
|
+
export PORT=8081
|
|
21
|
+
|
|
22
|
+
# Activate virtual environment
|
|
23
|
+
if [ "${OS-}" == "Windows_NT" ]; then
|
|
24
|
+
source .venv/Scripts/activate
|
|
25
|
+
else
|
|
26
|
+
source .venv/bin/activate
|
|
27
|
+
fi
|
|
28
|
+
|
scripts/lint.sh
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#!/bin/bash -eu
|
|
2
|
+
set -o pipefail
|
|
3
|
+
|
|
4
|
+
#-----------------------------------------------------------------------------
|
|
5
|
+
#
|
|
6
|
+
# Template script for running the linter
|
|
7
|
+
#
|
|
8
|
+
#-----------------------------------------------------------------------------
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
# Get script directory
|
|
12
|
+
SCRIPTS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
13
|
+
source "$SCRIPTS_DIR/config.sh"
|
|
14
|
+
|
|
15
|
+
# Check if the fix parameter is provided
|
|
16
|
+
FIX_MODE=false
|
|
17
|
+
if [[ $# -gt 0 && "$1" == "--fix" ]]; then
|
|
18
|
+
FIX_MODE=true
|
|
19
|
+
fi
|
|
20
|
+
|
|
21
|
+
# Run linter
|
|
22
|
+
if [ "$FIX_MODE" = true ]; then
|
|
23
|
+
echo "Running linters in fix mode..."
|
|
24
|
+
ruff format .
|
|
25
|
+
ruff check --fix .
|
|
26
|
+
else
|
|
27
|
+
echo "Running linters in check mode..."
|
|
28
|
+
ruff format --check .
|
|
29
|
+
ruff check .
|
|
30
|
+
fi
|
|
31
|
+
echo "Running pylint..."
|
|
32
|
+
pylint aixtools/
|
scripts/log_view.sh
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/bin/bash -eu
|
|
2
|
+
set -o pipefail
|
|
3
|
+
|
|
4
|
+
#-----------------------------------------------------------------------------
|
|
5
|
+
#
|
|
6
|
+
# Template script for running the Chainlit server
|
|
7
|
+
#
|
|
8
|
+
#-----------------------------------------------------------------------------
|
|
9
|
+
|
|
10
|
+
# Get script directory
|
|
11
|
+
SCRIPTS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
12
|
+
source "$SCRIPTS_DIR/config.sh"
|
|
13
|
+
|
|
14
|
+
# Activate virtual environment (with special handling for Windows)
|
|
15
|
+
cd "$PROJECT_DIR"
|
|
16
|
+
|
|
17
|
+
# Run the server
|
|
18
|
+
streamlit run aixtools/log_view/app.py $*
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/bin/bash -eu
|
|
2
|
+
set -o pipefail
|
|
3
|
+
|
|
4
|
+
# Get script directory
|
|
5
|
+
SCRIPTS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
6
|
+
source "$SCRIPTS_DIR/config.sh"
|
|
7
|
+
|
|
8
|
+
# Activate virtual environment (with special handling for Windows)
|
|
9
|
+
cd "$PROJECT_DIR"
|
|
10
|
+
|
|
11
|
+
# Run the example MCP server
|
|
12
|
+
fastmcp run \
|
|
13
|
+
--transport http \
|
|
14
|
+
"$PROJECT_DIR/aixtools/mcp/example_server.py"
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/bin/bash -eu
|
|
2
|
+
set -o pipefail
|
|
3
|
+
|
|
4
|
+
# Get script directory
|
|
5
|
+
SCRIPTS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
6
|
+
source "$SCRIPTS_DIR/config.sh"
|
|
7
|
+
|
|
8
|
+
cd "$PROJECT_DIR"
|
|
9
|
+
|
|
10
|
+
while true; do
|
|
11
|
+
uv run aixtools/mcp/faulty_mcp.py "$@" || true
|
|
12
|
+
echo "MCP server terminated. Restarting..."
|
|
13
|
+
done
|
scripts/run_server.sh
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/bin/bash -eu
|
|
2
|
+
set -o pipefail
|
|
3
|
+
|
|
4
|
+
#-----------------------------------------------------------------------------
|
|
5
|
+
#
|
|
6
|
+
# Template script for running the Chainlit server
|
|
7
|
+
#
|
|
8
|
+
#-----------------------------------------------------------------------------
|
|
9
|
+
|
|
10
|
+
# Get script directory
|
|
11
|
+
SCRIPTS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
12
|
+
source "$SCRIPTS_DIR/config.sh"
|
|
13
|
+
|
|
14
|
+
# Activate virtual environment (with special handling for Windows)
|
|
15
|
+
cd "$PROJECT_DIR"
|
|
16
|
+
|
|
17
|
+
# Run linter before starting the server
|
|
18
|
+
"$SCRIPTS_DIR/lint.sh"
|
|
19
|
+
|
|
20
|
+
# Go into the sub-dir (most projects don't need this)
|
|
21
|
+
cd "$PROJECT_NAME"
|
|
22
|
+
|
|
23
|
+
# Run the server
|
|
24
|
+
chainlit run \
|
|
25
|
+
--host 0.0.0.0 \
|
|
26
|
+
--port $PORT \
|
|
27
|
+
--root-path /$PROJECT_NAME \
|
|
28
|
+
--watch \
|
|
29
|
+
app.py
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
aixtools
|
|
File without changes
|
|
File without changes
|