Skip to content
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

[0.0.6] - 3-21-2024 Bug Fixes #47

Merged
merged 93 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
5341ebf
🧪 asyncify tests
hyusap Jan 31, 2024
942137f
✨ asyncify client
hyusap Jan 31, 2024
387fb66
Basic Test for Page based pagination
VVoruganti Feb 6, 2024
410f914
add sync buildstep and client
hyusap Feb 6, 2024
4495fdf
add vscode DX
hyusap Feb 6, 2024
6033f71
Added Testing for generators and updated examples
VVoruganti Feb 6, 2024
2a3d9f7
feat: example updates
vintrocode Feb 7, 2024
1c9ee99
Merge pull request #10 from plastic-labs/vscode
VVoruganti Feb 7, 2024
d59e1ee
readme exists now
vintrocode Feb 7, 2024
4f650d3
Stylistic changes and generic message
VVoruganti Feb 8, 2024
31d895f
Merge pull request #13 from plastic-labs/vineeth/dev-153
VVoruganti Feb 8, 2024
74199c1
Merge branch 'staging' into ayush/dev-153
VVoruganti Feb 8, 2024
785dd36
Merge pull request #8 from plastic-labs/ayush/dev-153
VVoruganti Feb 8, 2024
870995d
Merge pull request #12 from plastic-labs/vince/example-updates
VVoruganti Feb 8, 2024
0438edb
Merge branch 'staging' into vineeth/dev-154
VVoruganti Feb 8, 2024
8a750a6
Merge pull request #11 from plastic-labs/vineeth/dev-154
VVoruganti Feb 8, 2024
3fd1bf9
Metamessages with other refactoring - untested
VVoruganti Feb 8, 2024
3926aaf
Work with unit tests
VVoruganti Feb 8, 2024
ddaa311
Fix Examples
VVoruganti Feb 8, 2024
a7373d1
MEME-78 Update Changelogs
VVoruganti Feb 8, 2024
f99f1e8
Docstrings to client
VVoruganti Feb 8, 2024
061dd83
Merge pull request #14 from plastic-labs/vineeth/dev-181
VVoruganti Feb 8, 2024
716e8ca
🧪 autogenerate sync tests
hyusap Feb 14, 2024
735d780
test one
hyusap Feb 14, 2024
783156f
add db type
hyusap Feb 14, 2024
287db71
sync client
hyusap Feb 14, 2024
811c726
add status badge
hyusap Feb 14, 2024
cb42724
add coverage
hyusap Feb 14, 2024
77f180a
add file
hyusap Feb 14, 2024
f359be4
give perms
hyusap Feb 14, 2024
178b488
properly output coverage
hyusap Feb 14, 2024
18241c9
split test and coverage
hyusap Feb 14, 2024
555c848
rename action
hyusap Feb 14, 2024
fcde94e
🧪 autogenerate sync tests (#16)
hyusap Feb 15, 2024
8421fda
Vector Support (#18)
VVoruganti Feb 15, 2024
e8730df
Merge branch 'main' into staging
VVoruganti Feb 15, 2024
6c4cfe1
Merge branch 'main' into staging
VVoruganti Feb 21, 2024
614242b
Add reverse parameters for paginated routes
VVoruganti Feb 21, 2024
ef636ce
Address dependabot
VVoruganti Feb 21, 2024
10b65b2
Formatting
VVoruganti Feb 21, 2024
f82bd7f
initial commit on honcho dspy personas
vintrocode Feb 20, 2024
53d952f
working, hit token limit and can't test dspy optimization
vintrocode Feb 20, 2024
8c5845f
initial version working, need to test optimization
vintrocode Feb 21, 2024
07651cb
optimizers working, but appending any example
vintrocode Feb 22, 2024
364ba9a
ready for user object (tbomk)
vintrocode Feb 22, 2024
197a658
Merge branch 'actions' into staging
hyusap Feb 22, 2024
ad4cec3
Revert "add test actions and coverage"
hyusap Feb 22, 2024
794a38f
Merge pull request #28 from plastic-labs/revert-17-actions
hyusap Feb 22, 2024
dee6ba7
Refactor to add User and App Tables
VVoruganti Feb 22, 2024
569870c
User Object passing test cases
VVoruganti Feb 22, 2024
0f783c3
Update examples
VVoruganti Feb 22, 2024
9abafa7
DSPy Todo and documentation updates
VVoruganti Feb 22, 2024
c584fad
Add is_active filtering
VVoruganti Feb 22, 2024
67b1601
Add is_active filtering to the generator
VVoruganti Feb 22, 2024
876e8e8
Fix update user metadata
VVoruganti Feb 22, 2024
cf79652
working, but weird compiler error
vintrocode Feb 23, 2024
3a2f5ea
fixed str error in optimizer
vintrocode Feb 23, 2024
21c325b
ship
vintrocode Feb 23, 2024
122d37d
Merge branch 'main' into staging
VVoruganti Feb 26, 2024
b78d502
sentry
VVoruganti Feb 27, 2024
6714d25
Open Telemetry
VVoruganti Feb 28, 2024
da5f555
optional logging with environment variables
VVoruganti Feb 29, 2024
f40ec07
add actions again? (#29)
hyusap Mar 6, 2024
c1c35de
⚙️ chore: update start script in VS Code to include poetry install --…
hyusap Mar 6, 2024
8be7a9e
Refactored code but need to tweak asyncpg
VVoruganti Feb 29, 2024
a46fa2b
Working Async API using Psycopg3
VVoruganti Mar 6, 2024
9be9c1b
Update Workflow Connection URI
VVoruganti Mar 6, 2024
0e6b56a
Update Workflow Connection URI in coverage test as well
VVoruganti Mar 6, 2024
8258933
Skeleton for Dialectic API
VVoruganti Mar 8, 2024
bf6c1a7
Fixes DEV-217 URL Encoding
VVoruganti Mar 12, 2024
b5935ec
Add Built-in Langchain Utility function
VVoruganti Mar 12, 2024
29b9365
Sphinx Docs MVP
VVoruganti Mar 13, 2024
c4b0151
Metadata filtering for all fixes dev-261
VVoruganti Mar 14, 2024
d59ea18
Basic Dialectic Endpoint fixes dev-253
VVoruganti Mar 14, 2024
52233ef
Working Fact Deriver
VVoruganti Mar 14, 2024
37634b5
0.0.5 Docs and README updates
VVoruganti Mar 14, 2024
09b3e31
Cloudflare Sphinx
VVoruganti Mar 14, 2024
510a659
update example to use right function (#36)
vintrocode Mar 17, 2024
dce2f44
🚀 feat: add support for running API using docker-compose with configu…
hyusap Mar 17, 2024
d4cd018
add interrogate
hyusap Mar 16, 2024
7af03f1
routerify everything
hyusap Mar 16, 2024
04a6764
full docstring coverage
hyusap Mar 17, 2024
3f1a1f7
remove unused imports and fix env issue
hyusap Mar 17, 2024
2c1c1fb
Update docker-compose connection uri and remove auto-stop to deriver …
VVoruganti Mar 17, 2024
ad5a16f
Docstrings and langchain message converter in reverse
VVoruganti Mar 17, 2024
98a3934
Sentry, OTEL, langchain both directions, fly.toml for deriver
VVoruganti Mar 20, 2024
e090e80
Rename to deriver
VVoruganti Mar 20, 2024
3026e41
Fix favicon and remove metadata from schema
VVoruganti Mar 21, 2024
9a86410
0.0.6 Notes
VVoruganti Mar 21, 2024
81d5f8a
Merge branch 'main' into staging
VVoruganti Mar 21, 2024
da2d3e9
Changelog edit
VVoruganti Mar 21, 2024
dfcb45b
Route bug fix
VVoruganti Mar 21, 2024
5fdfdbc
Route bug fix again
VVoruganti Mar 21, 2024
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
3 changes: 3 additions & 0 deletions .github/workflows/run_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ jobs:
poetry install
poetry run coverage run -m pytest
poetry run coverage report --format=markdown > coverage.md
echo -e "\n---\n# Docstring Coverage\n\`\`\`" >> coverage.md
poetry run interrogate -v honcho >> coverage.md
echo -e "\`\`\`" >> coverage.md
cd ..
- name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
api/**/*.db

api/data
api/docker-compose.yml


# Byte-compiled / optimized / DLL files
Expand Down
62 changes: 38 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,30 @@
# Honcho
![Static Badge](https://img.shields.io/badge/Version-0.0.5-blue)
# 🫡 Honcho
![Static Badge](https://img.shields.io/badge/Version-0.0.6-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)

A User context management solution for building AI Agents and LLM powered
applications.
Honcho is a platform for making AI agents and LLM powered applications that are personalized
to their end users.

Read about the motivation of this project [here](https://blog.plasticlabs.ai).

Read the user documenation [here](https://docs.honcho.dev)

## Table of Contents

- [Project Structure](#project-structure)
- [Usage](#usage)
- [API](#api)
- [Docker](#docker)
- [Manually](#manually)
- [Deploying on Fly.io](#deploy-on-fly)
- [Client SDK](#client-sdk)
- [Use Locally](#use-locally)
- [Contributing](#contributing)
- [License](#license)

## Project Structure

The Honcho repo is a monorepo containing the server/API that manages database
Expand All @@ -35,6 +48,19 @@ directories.

### API

#### Docker

The API can be run using docker-compose. The `docker-compose.yml.example` file can be copied to `docker-compose.yml` and the environment variables can be set in the `.env` file.

```bash
cd honcho/api
cp docker-compose.yml.example docker-compose.yml
[ update the file with openai key and other wanted environment variables ]
docker compose up -d
```

#### Manually

The API can be run either by installing the necessary dependencies and then
specifying the appropriate environment variables.

Expand All @@ -48,7 +74,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 All @@ -72,26 +98,11 @@ poetry shell # Activate virtual environment if not already enabled
python -m uvicorn src.main:app --reload
```

#### Docker

Alternatively there is also a `Dockerfile` included to run the API server from a
docker container.

The `.env` file is not loaded into the docker container and should still be
configured from outside.

```bash
cd honcho/api
docker build -t honcho-api .
docker run --env-file .env -p 8000:8000 honcho-api:latest
```

#### Deploy on Fly

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 All @@ -116,7 +127,10 @@ alternatively if you are using poetry run:
poetry add honcho-ai
```

checkout the [example folder](./example/) for examples of how to use the sdk
checkout the [SDK Reference](https://api.python.honcho.dev) for a detailed
look at the different methods and how to use them.

Also, check out the[example folder](./example/) for examples of how to use the sdk

#### Use Locally

Expand All @@ -134,12 +148,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
17 changes: 17 additions & 0 deletions api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [0.0.6] — 2024-03-21

### Added

* Full docker-compose for API and Database

### Fixed

* API Response schema removed unnecessary fields
* OTEL logging to properly work with async database engine
* `fly.toml` default settings for deriver set `auto_stop=false`

### Changed

* Refactored API server into multiple route files


## [0.0.5] — 2024-03-14

### Added
Expand Down
41 changes: 41 additions & 0 deletions api/docker-compose.yml.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
version: "3.8"
services:
api:
build:
context: .
dockerfile: Dockerfile
ports:
- 8000:8000
volumes:
- .:/app
environment:
- DATABASE_TYPE=postgres
- CONNECTION_URI=postgresql+psycopg://testuser:testpwd@database:5432/honcho
- OPENAI_API_KEY=[YOUR_OPENAI_API_KEY]
- OPENTELEMETRY_ENABLED=false
- SENTRY_ENABLED=false
- SENTRY_DSN=
- OTEL_SERVICE_NAME=honcho
- OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true
- OTEL_PYTHON_LOG_CORRELATION=true
- OTEL_PYTHON_LOG_LEVEL=
- OTEL_EXPORTER_OTLP_PROTOCOL=
- OTEL_EXPORTER_OTLP_ENDPOINT=
- OTEL_EXPORTER_OTLP_HEADERS=
- OTEL_RESOURCE_ATTRIBUTES=
- DEBUG_LOG_OTEL_TO_PROVIDER=false
- DEBUG_LOG_OTEL_TO_CONSOLE=true
database:
image: ankane/pgvector
restart: always
ports:
- 5432:5432
environment:
- POSTGRES_DB=honcho
- POSTGRES_USER=testuser
- POSTGRES_PASSWORD=testpwd
- POSTGRES_HOST_AUTH_METHOD=trust
- PGDATA=/var/lib/postgresql/data/pgdata
volumes:
- ./local/init.sql:/docker-entrypoint-initdb.d/init.sql
- ./data:/var/lib/postgresql/data/
14 changes: 12 additions & 2 deletions api/fly.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,17 @@ kill_timeout = "5s"

[processes]
api = "python -m uvicorn src.main:app --host 0.0.0.0 --port 8000"
deriver = "python -m src.harvester"
deriver = "python -m src.deriver"

[[services]]
auto_stop_machines = false
auto_start_machines = true
min_machines_running = 1
processes = ["deriver"]
protocol = "tcp"
[services.concurrency]
hard_limit = 250
soft_limit = 200

[http_service]
internal_port = 8000
Expand All @@ -31,4 +41,4 @@ kill_timeout = "5s"
cpu_kind = "shared"
cpus = 1
memory_mb = 512
processes = ["api"]
processes = ["api", "deriver"]
2 changes: 1 addition & 1 deletion api/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "honcho"
version = "0.0.5"
version = "0.0.6"
description = "Honcho Server"
authors = ["Plastic Labs <[email protected]>"]
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion api/src/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from sqlalchemy.ext.asyncio import async_sessionmaker, create_async_engine
from sqlalchemy.ext.declarative import declarative_base

load_dotenv()
load_dotenv(override=True)

connect_args = {}

Expand Down
15 changes: 15 additions & 0 deletions api/src/dependencies.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from fastapi import Depends
from .db import SessionLocal
from sqlalchemy.ext.asyncio import AsyncSession


async def get_db():
"""FastAPI Dependency Generator for Database"""
db: AsyncSession = SessionLocal()
try:
yield db
finally:
await db.close()


db: AsyncSession = Depends(get_db)
Loading
Loading