Skip to content

feat: Make this SDK using the OpenAI compatible endpoints #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 0 additions & 111 deletions .devcontainer/.zshrc

This file was deleted.

52 changes: 33 additions & 19 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
FROM mcr.microsoft.com/devcontainers/python:3.12-bookworm

ENV ZSH_CUSTOM=/home/vscode/.oh-my-zsh/custom \
BLACK_VERSION=24.10.0 \
ENV BLACK_VERSION=25.1.0 \
ISORT_VERSION=5.13.2 \
PYLINT_VERSION=3.3.3 \
PYLINT_VERSION=3.3.7 \
BUILD_VERSION=1.2.2.post1 \
TWINE_VERSION=6.0.1 \
TASK_VERSION=v3.41.0 \
PYTEST_VERSION=8.3.4 \
PYTEST_WATCH_VERSION=4.2.0
TWINE_VERSION=6.1.0 \
TASK_VERSION=v3.43.3 \
PYTEST_VERSION=8.3.5 \
PYTEST_WATCH_VERSION=4.2.0 \
PRE_COMMIT_VERSION=4.2.0

RUN apt-get update && \
# Install GitHub CLI
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg && \
chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg && \
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 && \
apt-get update && \
apt-get install -y gh && \
# Install nodejs and npm
curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - && \
apt-get install -y nodejs && \
Expand All @@ -20,23 +26,31 @@ RUN apt-get update && \
python -m pip install --upgrade pip && \
# Install development tools using pip
pip install black==${BLACK_VERSION} \
isort==${ISORT_VERSION} \
pylint==${PYLINT_VERSION} \
build==${BUILD_VERSION} \
twine==${TWINE_VERSION} \
pytest==${PYTEST_VERSION} \
pytest-watch==${PYTEST_WATCH_VERSION} \
pytest-cov \
pytest-xdist \
debugpy && \
isort==${ISORT_VERSION} \
pylint==${PYLINT_VERSION} \
build==${BUILD_VERSION} \
twine==${TWINE_VERSION} \
pytest==${PYTEST_VERSION} \
pytest-watch==${PYTEST_WATCH_VERSION} \
pytest-cov \
pytest-xdist \
datamodel-code-generator \
pre-commit==${PRE_COMMIT_VERSION} \
debugpy && \
# Clean up
apt-get clean && \
rm -rf /var/lib/apt/lists/*

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

# Install powerlevel10k theme
RUN git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM}/themes/powerlevel10k

USER vscode

# Use Powerlevel10k theme
RUN git clone --depth=1 https://github.com/romkatv/powerlevel10k.git /home/vscode/.powerlevel10k && \
echo 'source /home/vscode/.powerlevel10k/powerlevel10k.zsh-theme' >> /home/vscode/.zshrc && \
echo 'POWERLEVEL9K_DISABLE_CONFIGURATION_WIZARD=true' >> /home/vscode/.zshrc

# Shell completion
RUN echo "source <(gh completion -s zsh)" >> /home/vscode/.zshrc
RUN echo "source <(task --completion zsh)" >> /home/vscode/.zshrc
71 changes: 60 additions & 11 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"name": "Debian with Python 3",
"dockerFile": "Dockerfile",
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:latest": {}
},
"customizations": {
"vscode": {
"extensions": [
Expand All @@ -14,22 +17,27 @@
"ms-python.python",
"ms-python.vscode-pylance",
"ms-python.black-formatter",
"ms-python.isort",
"tamasfe.even-better-toml"
],
"settings": {
"python.pythonPath": "/usr/local/bin/python",
"python.linting.enabled": true,
"python.linting.pylintEnabled": false,
"python.formatting.provider": "black",
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
"python.sortImports.path": "/usr/local/py-utils/bin/isort",
"python.defaultInterpreterPath": "/usr/local/bin/python",
"terminal.integrated.defaultProfile.linux": "zsh",
"editor.renderWhitespace": "all",
"cSpell.enabled": true,
"cSpell.files": ["**/*.md"],
"editor.formatOnSave": true,
"editor.defaultFormatter": "ms-python.black-formatter",
"black-formatter.args": ["--config", "pyproject.toml"],
"isort.args": ["--profile", "black", "--line-length", "100"],
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit"
},
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
},
"git.enableCommitSigning": true,
"dev.containers.copyGitConfig": true,
"githubPullRequests.experimental.chat": true,
Expand All @@ -38,16 +46,57 @@
"python.testing.pytestEnabled": true,
"python.testing.unittestEnabled": false,
"python.testing.nosetestsEnabled": false,
"python.testing.pytestArgs": [
"tests"
]
"python.testing.pytestArgs": ["tests"],
"notebook.insertFinalNewline": true,
"yaml.schemas": {
"https://json.schemastore.org/pre-commit-config.json": [
".pre-commit-config.yaml",
".pre-commit-config.yml"
]
},
"yaml.schemaStore.enable": true,
"yaml.validate": true,
"github.copilot.enable": {
"*": true
},
"github.copilot.advanced": {
"authProvider": "github"
},
"github.copilot.chat.codeGeneration.useInstructionFiles": true,
"github.copilot.chat.commitMessageGeneration.instructions": [
{
"text": "Always use conventional commit message format."
}
],
"github.copilot.chat.pullRequestDescriptionGeneration.instructions": [
{
"text": "Always fill the pull request with the following information: \n ## Summary\n <summary of the pull request>\n"
}
],
"github.copilot.chat.testGeneration.instructions": [
{
"text": "Always use table-driven tests."
}
],
"mcp": {
"servers": {
"Context7": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"node:lts",
"npx",
"-y",
"@upstash/context7-mcp@latest"
]
}
}
}
}
}
},
"mounts": [
"source=${localWorkspaceFolder}/.devcontainer/.zshrc,target=/home/vscode/.zshrc,type=bind,consistency=cached",
"source=${localWorkspaceFolder}/.devcontainer/launch.json,target=/workspaces/python-sdk/.vscode/launch.json,type=bind,consistency=cached"
],
"postCreateCommand": "pip install -r requirements.txt",
"remoteEnv": {
"GITHUB_TOKEN": "${localEnv:GITHUB_TOKEN}"
Expand Down
31 changes: 0 additions & 31 deletions .devcontainer/launch.json

This file was deleted.

47 changes: 47 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Custom Instructions for Copilot

Today is May 26, 2025.

- Always use context7 to check for the latest updates, features, or best practices of a library relevant to the task at hand.
- Always prefer Table-Driven Testing: When writing tests.
- Always use Early Returns: Favor early returns to simplify logic and avoid deep nesting with if-else structures.
- Always prefer switch statements over if-else chains: Use switch statements for cleaner and more readable code when checking multiple conditions.
- Always run `task lint` before committing code to ensure it adheres to the project's linting rules.
- Always run `task test` before committing code to ensure all tests pass.
- Always search for the simplest solution first before considering more complex alternatives.
- Always prefer type safety over dynamic typing: Use strong typing and interfaces to ensure type safety and reduce runtime errors.
- When possible code to an interface so it's easier to mock in tests.
- When writing tests, each test case should have it's own isolated mock server mock dependecies so it's easier to understand and maintain.

## Development Workflow

### Configuration Changes

When adding new configuration fields:

1. Run `task oas-download` - OpenAPI is the source of truth - readonly file.
2. If added new Schemas to openapi.yaml, make sure to run `task generate` to regenerate the Python code.
3. Run `task lint` to ensure code quality
4. Run `task test` to ensure all tests pass
5. Update the README.md file or any documentation files with the recently added implementation

## Available Tools and MCPs

- context7 - Helps by finding the latest updates, features, or best practices of a library relevant to the task at hand.

## Related Repositories

- [Inference Gateway](https://github.com/inference-gateway)
- [Inference Gateway UI](https://github.com/inference-gateway/ui)
- [Go SDK](https://github.com/inference-gateway/go-sdk)
- [Rust SDK](https://github.com/inference-gateway/rust-sdk)
- [TypeScript SDK](https://github.com/inference-gateway/typescript-sdk)
- [Python SDK](https://github.com/inference-gateway/python-sdk)
- [Documentation](https://docs.inference-gateway.com)

## MCP Useful links

- [Introduction](https://modelcontextprotocol.io/introduction)
- [Specification](https://modelcontextprotocol.io/specification)
- [Examples](https://modelcontextprotocol.io/examples)
- [Schema](https://github.com/modelcontextprotocol/modelcontextprotocol/refs/heads/main/schema/draft/schema.json)
Loading