Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
4bfade1
📦 NEW: Python SDK
arre-ankit Jul 4, 2025
be835dc
👌 IMPROVE: Readme
arre-ankit Jul 4, 2025
f99073b
📦 NEW: Embed
arre-ankit Jul 4, 2025
b83987c
📦 NEW: CI-CD
arre-ankit Jul 4, 2025
f01e8c2
🐛 FIX: Timeout parameter
arre-ankit Jul 8, 2025
8af084f
📦 NEW: Helper functions
arre-ankit Jul 9, 2025
f2e3d59
📦 NEW: Test
arre-ankit Jul 9, 2025
8054ec3
👌 IMPROVE: Contribution
arre-ankit Jul 10, 2025
42e1066
🐛 FIX: Formatting
arre-ankit Jul 10, 2025
0527ad2
👌 IMPROVE: Examples
arre-ankit Jul 10, 2025
ab23911
🐛 FIX: Formatting
arre-ankit Jul 10, 2025
1602674
👌 IMPROVE: conftest
saqibameen Jul 10, 2025
efaf8dc
👌🏻 IMP: Review
saqibameen Jul 10, 2025
54c9f7d
👌 IMPROVE: Pipes Type
arre-ankit Jul 14, 2025
c0d697d
👌 IMPROVE: Primitives
arre-ankit Jul 17, 2025
ad1d990
🐛 FIX: Types Fix
arre-ankit Jul 17, 2025
bd50ec1
👌 IMPROVE: Test with validations
arre-ankit Jul 17, 2025
6724f01
🐛 FIX: Types
arre-ankit Jul 17, 2025
12c4e1e
👌 IMPROVE: lint
saqibameen Jul 17, 2025
9eccd8d
🐛 FIX: agent examples
saqibameen Jul 18, 2025
47ee2de
👌 IMPROVE: Chunker Example
arre-ankit Jul 18, 2025
cd31744
📖 DOC: remove extra readme
saqibameen Jul 18, 2025
d2d368e
🐛 FIX: memory examples
saqibameen Jul 18, 2025
8d84c55
👌 IMPROVE: embed example
saqibameen Jul 18, 2025
885c8e3
👌 IMPROVE: web search tools
saqibameen Jul 18, 2025
54e55d8
🐛 FIX: threads create
saqibameen Jul 18, 2025
d75de24
🐛 FIX: threads messages list
saqibameen Jul 18, 2025
a963d8b
🐛 FIX: threads messages list
saqibameen Jul 18, 2025
1dadc0b
🐛 FIX: threads implementation
saqibameen Jul 18, 2025
bfeedbd
🐛 FIX: workflow
saqibameen Jul 18, 2025
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
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/1.bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Bug report
description: Report a bug for Langbase.
labels: []
body:
- type: markdown
attributes:
value: |
This template is to report bugs for the Langbase. If you need help with your own project, feel free to [start a new thread in our discord forum](https://langbase.com/discord).
- type: textarea
attributes:
label: Description
description: A detailed bug description for Langbase and steps to reproduce it. Include the API, framework, and AI provider you're using.
placeholder: |
Steps to reproduce...
validations:
required: true
- type: textarea
attributes:
label: Code example
description: Provide an example code snippet that may have a problem
placeholder: |
...
- type: textarea
attributes:
label: Additional context
description: |
Any additional information that might help us investigate.
25 changes: 25 additions & 0 deletions .github/ISSUE_TEMPLATE/2.feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Feature Request
description: Propose a new feature for Langbase.
labels: []
body:
- type: markdown
attributes:
value: |
Use this template to propose new features for Langbase. If you need help with your own project, feel free to [start a new thread in our discord forum](https://langbase.com/discord).
- type: textarea
attributes:
label: Feature Description
description: Describe the feature you are proposing. Include the API, framework, and AI provider.
placeholder: Feature description...
validations:
required: true
- type: textarea
attributes:
label: Use Case
description: Explain how this feature would be beneficial.
placeholder: Use case...
- type: textarea
attributes:
label: Additional Context
description: Any additional information that might help us understand your request.
placeholder: Additional context...
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Ask a Question
url: https://langbase.com/discord
about: Please ask your questions in our discord forum.
7 changes: 7 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## TLDR

<!-- Add a brief description of what this pull request changes and why and any important things for reviewers to look at -->

## Dive Deeper

<!-- more thoughts and in depth discussion here -->
27 changes: 27 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Test

on:
pull_request:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt

- name: Run tests
run: |
pytest
26 changes: 26 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: check-json
- id: check-merge-conflict
- id: check-toml
- id: debug-statements
- id: mixed-line-ending

- repo: https://github.com/psf/black
rev: 23.12.1
hooks:
- id: black
language_version: python3
args: [.]

- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
args: [--profile=black, --line-length=88]
196 changes: 196 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
# Contributing to Langbase Python SDK

Thank you for your interest in contributing to the Langbase Python SDK! We welcome contributions from the community.

## Getting Started

### Prerequisites

- Python 3.7 or higher
- pip package manager
- git

### Development Setup

1. **Fork and clone the repository**
```bash
git clone https://github.com/langbase/langbase-python-sdk
cd langbase-python-sdk
```

2. **Create a virtual environment**
```bash
python3 -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
```
### Note:
Check version of pip
```bash
pip --version
```
**If it's pip 21.3 or lower, you need to upgrade it.**
```bash
pip install --upgrade pip
```

3. **Install the package in development mode**
```bash
pip install -e .
```

4. **Install development dependencies**
```bash
pip install -r requirements-dev.txt
```

5. **Install pre-commit hooks**
```bash
pre-commit install
```

## Before You Commit

**IMPORTANT**: All code must pass quality checks before committing. Run these commands:

### Format Your Code
```bash
# Auto-format with Black (required)
black langbase/ tests/ examples/

# Sort imports with isort (required)
isort langbase/ tests/ examples/
```


### 4. Run Tests
```bash
# Run all tests
pytest

# Run with coverage
pytest --cov=langbase

# Run specific test file
pytest tests/test_pipes.py

# Run in verbose mode
pytest -v
```

### 5. Run All Checks at Once
```bash
# This runs all pre-commit hooks (black, isort)
pre-commit run --all-files
```

## Quick Checklist

Before pushing your changes, ensure:

- [ ] ✅ Code is formatted with `black`
- [ ] ✅ Imports are sorted with `isort`
- [ ] ✅ All tests pass with `pytest`
- [ ] ✅ New features have tests
- [ ] ✅ New features have type hints
- [ ] ✅ Documentation is updated if needed

## Making Changes

### 1. Create a Feature Branch
```bash
git checkout -b feature/your-feature-name
```

### 2. Make Your Changes
- Write clean, readable code
- Add type hints to all functions
- Follow existing code patterns
- Add docstrings to public functions

### 3. Add Tests
- Write tests for new features
- Ensure existing tests still pass
- Aim for good test coverage

### 4. Update Documentation
- Update README.md if adding new features
- Update docstrings
- Add examples if applicable

### 5. Commit Your Changes
```bash
# Stage your changes
git add .

# Commit with a descriptive message
git commit -m "📖 DOC: Improved contribution docs"
```

Follow conventional commit format:
- `📦 NEW:` New feature
- `🐛 BUG:` Bug fix
- `📖 Docs:` Documentation changes
- `👌🏻 IMP:` Improvements

### 6. Push and Create PR
```bash
git push origin feature/your-feature-name
```

Then create a Pull Request on GitHub.

## Code Style Guide

### Type Hints
All functions should have type hints:
```python
def process_data(input_text: str, max_length: int = 100) -> Dict[str, Any]:
"""Process input text and return results."""
...
```

### Docstrings
Use Google-style docstrings:
```python
def my_function(param1: str, param2: int) -> bool:
"""
Brief description of function.

Args:
param1: Description of param1
param2: Description of param2

Returns:
Description of return value
...
```


## Testing Guidelines

### Writing Tests
- Use pytest for all tests
- Use descriptive test names
- Test both success and error cases
- Use fixtures for common setup

Example:
```python
def test_pipe_run_with_invalid_name_raises_error(langbase_client):
"""Test that running a pipe with invalid name raises appropriate error."""
with pytest.raises(NotFoundError) as exc_info:
langbase_client.pipes.run(name="non-existent-pipe")

assert "404" in str(exc_info.value)
```

## Need Help?

- Check existing issues and PRs
- Read the [documentation](https://langbase.com/docs)
- Ask in our [Discord community](https://discord.gg/langbase)
- Open an issue for bugs or feature requests

## License

By contributing, you agree that your contributions will be licensed under the MIT License.
13 changes: 13 additions & 0 deletions LICENCE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright 2023 Langbase, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Loading