Skip to content

Commit 7e74a80

Browse files
authored
feat: Make this SDK using the OpenAI compatible endpoints (#1)
* docs(openapi): Download the latest OpenAPI Signed-off-by: Eden Reich <[email protected]> * feat: Add MCP tools management and update OpenAPI specification - Introduced a new endpoint for listing MCP tools in the OpenAPI specification. - Updated model IDs in the OpenAPI spec to include provider prefixes. - Enhanced error handling for unauthorized and MCP not exposed responses. - Added new Pydantic models for MCP tools and their responses. - Updated tests to cover new functionality for listing MCP tools and handling errors. - Bumped version to 0.4.0 and updated dependencies in pyproject.toml and requirements.txt. - Added new templates for Pydantic model generation based on OpenAPI spec. Signed-off-by: Eden Reich <[email protected]> * ci: Update GitHub Actions dependencies and Python setup Signed-off-by: Eden Reich <[email protected]> * chore: Update GitHub Actions dependencies and versions in release workflow Signed-off-by: Eden Reich <[email protected]> * build: Update development environment with pre-commit hooks and dependencies Signed-off-by: Eden Reich <[email protected]> * chore: Update dependencies in pre-commit, pyproject, and requirements files Signed-off-by: Eden Reich <[email protected]> * chore: Add cleanup for node_modules in the clean task Signed-off-by: Eden Reich <[email protected]> * fix: Correct types-requests version in requirements.txt Signed-off-by: Eden Reich <[email protected]> * docs: Revise README for improved structure and clarity, adding features and usage examples Signed-off-by: Eden Reich <[email protected]> --------- Signed-off-by: Eden Reich <[email protected]>
1 parent 43a1e00 commit 7e74a80

File tree

21 files changed

+3068
-1140
lines changed

21 files changed

+3068
-1140
lines changed

.devcontainer/.zshrc

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

.devcontainer/Dockerfile

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
FROM mcr.microsoft.com/devcontainers/python:3.12-bookworm
22

3-
ENV ZSH_CUSTOM=/home/vscode/.oh-my-zsh/custom \
4-
BLACK_VERSION=24.10.0 \
3+
ENV BLACK_VERSION=25.1.0 \
54
ISORT_VERSION=5.13.2 \
6-
PYLINT_VERSION=3.3.3 \
5+
PYLINT_VERSION=3.3.7 \
76
BUILD_VERSION=1.2.2.post1 \
8-
TWINE_VERSION=6.0.1 \
9-
TASK_VERSION=v3.41.0 \
10-
PYTEST_VERSION=8.3.4 \
11-
PYTEST_WATCH_VERSION=4.2.0
7+
TWINE_VERSION=6.1.0 \
8+
TASK_VERSION=v3.43.3 \
9+
PYTEST_VERSION=8.3.5 \
10+
PYTEST_WATCH_VERSION=4.2.0 \
11+
PRE_COMMIT_VERSION=4.2.0
1212

1313
RUN apt-get update && \
14+
# Install GitHub CLI
15+
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg && \
16+
chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg && \
17+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null && \
18+
apt-get update && \
19+
apt-get install -y gh && \
1420
# Install nodejs and npm
1521
curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - && \
1622
apt-get install -y nodejs && \
@@ -20,23 +26,31 @@ RUN apt-get update && \
2026
python -m pip install --upgrade pip && \
2127
# Install development tools using pip
2228
pip install black==${BLACK_VERSION} \
23-
isort==${ISORT_VERSION} \
24-
pylint==${PYLINT_VERSION} \
25-
build==${BUILD_VERSION} \
26-
twine==${TWINE_VERSION} \
27-
pytest==${PYTEST_VERSION} \
28-
pytest-watch==${PYTEST_WATCH_VERSION} \
29-
pytest-cov \
30-
pytest-xdist \
31-
debugpy && \
29+
isort==${ISORT_VERSION} \
30+
pylint==${PYLINT_VERSION} \
31+
build==${BUILD_VERSION} \
32+
twine==${TWINE_VERSION} \
33+
pytest==${PYTEST_VERSION} \
34+
pytest-watch==${PYTEST_WATCH_VERSION} \
35+
pytest-cov \
36+
pytest-xdist \
37+
datamodel-code-generator \
38+
pre-commit==${PRE_COMMIT_VERSION} \
39+
debugpy && \
3240
# Clean up
3341
apt-get clean && \
3442
rm -rf /var/lib/apt/lists/*
3543

3644
# Install semantic-release
3745
RUN npm install -g semantic-release @semantic-release/changelog @semantic-release/exec @semantic-release/git @semantic-release/github conventional-changelog-conventionalcommits
3846

39-
# Install powerlevel10k theme
40-
RUN git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM}/themes/powerlevel10k
41-
4247
USER vscode
48+
49+
# Use Powerlevel10k theme
50+
RUN git clone --depth=1 https://github.com/romkatv/powerlevel10k.git /home/vscode/.powerlevel10k && \
51+
echo 'source /home/vscode/.powerlevel10k/powerlevel10k.zsh-theme' >> /home/vscode/.zshrc && \
52+
echo 'POWERLEVEL9K_DISABLE_CONFIGURATION_WIZARD=true' >> /home/vscode/.zshrc
53+
54+
# Shell completion
55+
RUN echo "source <(gh completion -s zsh)" >> /home/vscode/.zshrc
56+
RUN echo "source <(task --completion zsh)" >> /home/vscode/.zshrc

.devcontainer/devcontainer.json

Lines changed: 60 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
22
"name": "Debian with Python 3",
33
"dockerFile": "Dockerfile",
4+
"features": {
5+
"ghcr.io/devcontainers/features/docker-in-docker:latest": {}
6+
},
47
"customizations": {
58
"vscode": {
69
"extensions": [
@@ -14,22 +17,27 @@
1417
"ms-python.python",
1518
"ms-python.vscode-pylance",
1619
"ms-python.black-formatter",
20+
"ms-python.isort",
1721
"tamasfe.even-better-toml"
1822
],
1923
"settings": {
2024
"python.pythonPath": "/usr/local/bin/python",
2125
"python.linting.enabled": true,
2226
"python.linting.pylintEnabled": false,
23-
"python.formatting.provider": "black",
24-
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
25-
"python.sortImports.path": "/usr/local/py-utils/bin/isort",
27+
"python.defaultInterpreterPath": "/usr/local/bin/python",
2628
"terminal.integrated.defaultProfile.linux": "zsh",
2729
"editor.renderWhitespace": "all",
2830
"cSpell.enabled": true,
2931
"cSpell.files": ["**/*.md"],
3032
"editor.formatOnSave": true,
31-
"editor.defaultFormatter": "ms-python.black-formatter",
3233
"black-formatter.args": ["--config", "pyproject.toml"],
34+
"isort.args": ["--profile", "black", "--line-length", "100"],
35+
"editor.codeActionsOnSave": {
36+
"source.organizeImports": "explicit"
37+
},
38+
"[python]": {
39+
"editor.defaultFormatter": "ms-python.black-formatter"
40+
},
3341
"git.enableCommitSigning": true,
3442
"dev.containers.copyGitConfig": true,
3543
"githubPullRequests.experimental.chat": true,
@@ -38,16 +46,57 @@
3846
"python.testing.pytestEnabled": true,
3947
"python.testing.unittestEnabled": false,
4048
"python.testing.nosetestsEnabled": false,
41-
"python.testing.pytestArgs": [
42-
"tests"
43-
]
49+
"python.testing.pytestArgs": ["tests"],
50+
"notebook.insertFinalNewline": true,
51+
"yaml.schemas": {
52+
"https://json.schemastore.org/pre-commit-config.json": [
53+
".pre-commit-config.yaml",
54+
".pre-commit-config.yml"
55+
]
56+
},
57+
"yaml.schemaStore.enable": true,
58+
"yaml.validate": true,
59+
"github.copilot.enable": {
60+
"*": true
61+
},
62+
"github.copilot.advanced": {
63+
"authProvider": "github"
64+
},
65+
"github.copilot.chat.codeGeneration.useInstructionFiles": true,
66+
"github.copilot.chat.commitMessageGeneration.instructions": [
67+
{
68+
"text": "Always use conventional commit message format."
69+
}
70+
],
71+
"github.copilot.chat.pullRequestDescriptionGeneration.instructions": [
72+
{
73+
"text": "Always fill the pull request with the following information: \n ## Summary\n <summary of the pull request>\n"
74+
}
75+
],
76+
"github.copilot.chat.testGeneration.instructions": [
77+
{
78+
"text": "Always use table-driven tests."
79+
}
80+
],
81+
"mcp": {
82+
"servers": {
83+
"Context7": {
84+
"command": "docker",
85+
"args": [
86+
"run",
87+
"-i",
88+
"--rm",
89+
"node:lts",
90+
"npx",
91+
"-y",
92+
"@upstash/context7-mcp@latest"
93+
]
94+
}
95+
}
96+
}
4497
}
4598
}
4699
},
47-
"mounts": [
48-
"source=${localWorkspaceFolder}/.devcontainer/.zshrc,target=/home/vscode/.zshrc,type=bind,consistency=cached",
49-
"source=${localWorkspaceFolder}/.devcontainer/launch.json,target=/workspaces/python-sdk/.vscode/launch.json,type=bind,consistency=cached"
50-
],
51100
"postCreateCommand": "pip install -r requirements.txt",
52101
"remoteEnv": {
53102
"GITHUB_TOKEN": "${localEnv:GITHUB_TOKEN}"

.devcontainer/launch.json

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

.github/copilot-instructions.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Custom Instructions for Copilot
2+
3+
Today is May 26, 2025.
4+
5+
- Always use context7 to check for the latest updates, features, or best practices of a library relevant to the task at hand.
6+
- Always prefer Table-Driven Testing: When writing tests.
7+
- Always use Early Returns: Favor early returns to simplify logic and avoid deep nesting with if-else structures.
8+
- Always prefer switch statements over if-else chains: Use switch statements for cleaner and more readable code when checking multiple conditions.
9+
- Always run `task lint` before committing code to ensure it adheres to the project's linting rules.
10+
- Always run `task test` before committing code to ensure all tests pass.
11+
- Always search for the simplest solution first before considering more complex alternatives.
12+
- Always prefer type safety over dynamic typing: Use strong typing and interfaces to ensure type safety and reduce runtime errors.
13+
- When possible code to an interface so it's easier to mock in tests.
14+
- When writing tests, each test case should have it's own isolated mock server mock dependecies so it's easier to understand and maintain.
15+
16+
## Development Workflow
17+
18+
### Configuration Changes
19+
20+
When adding new configuration fields:
21+
22+
1. Run `task oas-download` - OpenAPI is the source of truth - readonly file.
23+
2. If added new Schemas to openapi.yaml, make sure to run `task generate` to regenerate the Python code.
24+
3. Run `task lint` to ensure code quality
25+
4. Run `task test` to ensure all tests pass
26+
5. Update the README.md file or any documentation files with the recently added implementation
27+
28+
## Available Tools and MCPs
29+
30+
- context7 - Helps by finding the latest updates, features, or best practices of a library relevant to the task at hand.
31+
32+
## Related Repositories
33+
34+
- [Inference Gateway](https://github.com/inference-gateway)
35+
- [Inference Gateway UI](https://github.com/inference-gateway/ui)
36+
- [Go SDK](https://github.com/inference-gateway/go-sdk)
37+
- [Rust SDK](https://github.com/inference-gateway/rust-sdk)
38+
- [TypeScript SDK](https://github.com/inference-gateway/typescript-sdk)
39+
- [Python SDK](https://github.com/inference-gateway/python-sdk)
40+
- [Documentation](https://docs.inference-gateway.com)
41+
42+
## MCP Useful links
43+
44+
- [Introduction](https://modelcontextprotocol.io/introduction)
45+
- [Specification](https://modelcontextprotocol.io/specification)
46+
- [Examples](https://modelcontextprotocol.io/examples)
47+
- [Schema](https://raw.githubusercontent.com/modelcontextprotocol/modelcontextprotocol/refs/heads/main/schema/draft/schema.json)

0 commit comments

Comments
 (0)