Skip to content

Commit

Permalink
Merge branch 'actions' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
hyusap authored Feb 22, 2024
2 parents 364ba9a + 555c848 commit 197a658
Show file tree
Hide file tree
Showing 6 changed files with 169 additions and 27 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/run_coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Run Coverage
on: [pull_request]
jobs:
test:
permissions:
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install poetry
run: |
pip install poetry
- name: Syncify Client
run: |
python scripts/syncronizer.py
- name: Start Server
run: |
cd api
poetry install --no-root
poetry run uvicorn src.main:app &
sleep 5
cd ..
env:
DATABASE_TYPE: sqlite
CONNECTION_URI: sqlite:///api.db
- name: Run Tests
run: |
cd sdk
poetry install
poetry run coverage run -m pytest
poetry run coverage xml -o coverage.xml
cd ..
- name: Code Coverage
uses: irongut/[email protected]
with:
filename: sdk/coverage.xml
badge: true
output: file
format: markdown
- name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2
with:
recreate: true
path: code-coverage-results.md
- name: Stop Server
run: |
kill $(jobs -p) || true
38 changes: 38 additions & 0 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Run Tests
on: [push, pull_request]
jobs:
test:
permissions:
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install poetry
run: |
pip install poetry
- name: Syncify Client
run: |
python scripts/syncronizer.py
- name: Start Server
run: |
cd api
poetry install --no-root
poetry run uvicorn src.main:app &
sleep 5
cd ..
env:
DATABASE_TYPE: sqlite
CONNECTION_URI: sqlite:///api.db
- name: Run Tests
run: |
cd sdk
poetry install
poetry run pytest
cd ..
- name: Stop Server
run: |
kill $(jobs -p) || true
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# Honcho

![Static Badge](https://img.shields.io/badge/Version-0.0.3-blue)
[![Discord](https://img.shields.io/discord/1016845111637839922?style=flat&logo=discord&logoColor=23ffffff&label=Plastic%20Labs&labelColor=235865F2)](https://discord.gg/plasticlabs)
![GitHub License](https://img.shields.io/github/license/plastic-labs/honcho)
![GitHub Repo stars](https://img.shields.io/github/stars/plastic-labs/honcho)
[![X (formerly Twitter) URL](https://img.shields.io/twitter/url?url=https%3A%2F%2Ftwitter.com%2Fplastic_labs)](https://twitter.com/plastic_labs)

[![Run Tests](https://github.com/plastic-labs/honcho/actions/workflows/api_testing.yml/badge.svg?branch=staging)](https://github.com/plastic-labs/honcho/actions/workflows/api_testing.yml)

A User context management solution for building AI Agents and LLM powered
applications.

Expand Down Expand Up @@ -48,7 +51,7 @@ poetry install # install dependencies

2. Copy the `.env.template` file and specify the type of database and
connection_uri. For testing sqlite is fine. The below example uses an
in-memory sqlite database.
in-memory sqlite database.

> Honcho has been tested with Postgresql and PGVector
Expand Down Expand Up @@ -90,8 +93,7 @@ docker run --env-file .env -p 8000:8000 honcho-api:latest

The API can also be deployed on fly.io. Follow the [Fly.io
Docs](https://fly.io/docs/getting-started/) to setup your environment and the
`flyctl`.

`flyctl`.

Once `flyctl` is set up use the following commands to launch the application:

Expand Down Expand Up @@ -134,12 +136,12 @@ See more information [here](https://python-poetry.org/docs/cli/#add)
This project is completely open source and welcomes any and all open source
contributions. The workflow for contributing is to make a fork of the
repository. You can claim an issue in the issues tab or start a new thread to
indicate a feature or bug fix you are working on.
indicate a feature or bug fix you are working on.

Once you have finished your contribution make a PR pointed at the `staging`
branch, and it will be reviewed by a project manager. Feel free to join us in
our [discord](http://discord.gg/plasticlabs) to discuss your changes or get
help.
help.

Once your changes are accepted and merged into staging they will undergo a
period of live testing before entering the upstream into `main`
Expand Down
92 changes: 70 additions & 22 deletions sdk/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions sdk/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ httpx = "^0.26.0"
[tool.poetry.group.test.dependencies]
pytest = "^7.4.4"
pytest-asyncio = "^0.23.4"
coverage = "^7.4.1"

[build-system]
requires = ["poetry-core"]
Expand Down
2 changes: 2 additions & 0 deletions sdk/tests/test_sync.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pytest
from honcho import GetSessionPage, GetMessagePage, GetMetamessagePage, GetDocumentPage, Session, Message, Metamessage, Document

from honcho import Client as Honcho
from uuid import uuid1

Expand Down Expand Up @@ -343,6 +344,7 @@ def test_collection_query():
assert doc3.metadata == {"test": "test"}
assert doc3.content == "the user has owned pets in the past"


result = collection.query(query="does the user own pets", top_k=2)

assert result is not None
Expand Down

0 comments on commit 197a658

Please sign in to comment.