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.7] — 2024-04-01 #50

Merged
merged 100 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
100 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
f74125e
Langchain Utilities Refactor (#48)
VVoruganti Mar 25, 2024
2067168
Basic Auth Header validation
VVoruganti Mar 25, 2024
9d76eb6
Basic Auth Service
VVoruganti Mar 25, 2024
74fba33
Deriver reliability and default auth revoke
VVoruganti Mar 25, 2024
e4e3147
.env.template
VVoruganti Mar 25, 2024
b0fdf24
0.0.7 Updates
VVoruganti Apr 1, 2024
c51b85c
Merge branch 'main' into staging
VVoruganti Apr 1, 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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,5 @@ cython_debug/
.DS_Store

supabase/

docs/node_modules
38 changes: 37 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# 🫡 Honcho
![Static Badge](https://img.shields.io/badge/Version-0.0.6-blue)
![Static Badge](https://img.shields.io/badge/Version-0.0.7-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)

Honcho is a platform for making AI agents and LLM powered applications that are personalized
to their end users.
Honcho is a platform for making AI agents and LLM powered applications that are personalized
to their end users.

Expand All @@ -25,6 +27,19 @@ Read the user documenation [here](https://docs.honcho.dev)
- [Contributing](#contributing)
- [License](#license)

## 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 Down Expand Up @@ -61,6 +76,19 @@ docker compose up -d

#### Manually

#### 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 @@ -75,6 +103,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 @@ -103,6 +132,7 @@ python -m uvicorn src.main:app --reload
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 @@ -130,6 +160,10 @@ poetry add honcho-ai
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
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 @@ -149,11 +183,13 @@ 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
5 changes: 5 additions & 0 deletions api/.env.template
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ OPENAI_API_KEY=
OPENTELEMETRY_ENABLED=false # Set to true to enable OpenTelemetry logging and tracing
SENTRY_ENABLED=false # Set to true to enable Sentry logging and tracing

# Auth

USE_AUTH_SERVICE=false
AUTH_SERVICE_URL=http://localhost:8001

## Sentry
SENTRY_DSN=

Expand Down
6 changes: 6 additions & 0 deletions api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ 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.7] — 2024-04-01

### Added

* Authentication Middleware Interface

## [0.0.6] — 2024-03-21

### Added
Expand Down
1 change: 1 addition & 0 deletions api/docker-compose.yml.example
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ services:
- OTEL_RESOURCE_ATTRIBUTES=
- DEBUG_LOG_OTEL_TO_PROVIDER=false
- DEBUG_LOG_OTEL_TO_CONSOLE=true
- USE_AUTH_SERVICE=false
database:
image: ankane/pgvector
restart: always
Expand Down
15 changes: 0 additions & 15 deletions api/fly.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,10 @@ app = "honcho"
kill_signal = "SIGINT"
kill_timeout = "5s"

[experimental]
auto_rollback = true

[build]

[processes]
api = "python -m uvicorn src.main:app --host 0.0.0.0 --port 8000"
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
auto_stop_machines = false
Expand Down
2 changes: 1 addition & 1 deletion api/poetry.lock

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

3 changes: 2 additions & 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.6"
version = "0.0.7"
description = "Honcho Server"
authors = ["Plastic Labs <[email protected]>"]
readme = "README.md"
Expand All @@ -27,6 +27,7 @@ realtime = "^1.0.2"
psycopg = {extras = ["binary"], version = "^3.1.18"}
langchain = "^0.1.12"
langchain-openai = "^0.0.8"
httpx = "^0.27.0"

[tool.ruff.lint]
# from https://docs.astral.sh/ruff/linter/#rule-selection example
Expand Down
4 changes: 2 additions & 2 deletions api/src/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@


def scaffold_db():
"""Use a Sync Engine for scaffolding the database. DDL operations are unavailable
with Async Engines
"""use a sync engine for scaffolding the database. ddl operations are unavailable
with async engines
"""
engine = create_engine(os.environ["CONNECTION_URI"], echo=True)
Base.metadata.create_all(bind=engine)
Expand Down
3 changes: 2 additions & 1 deletion api/src/dependencies.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from fastapi import Depends
from .db import SessionLocal
from sqlalchemy.ext.asyncio import AsyncSession

from .db import SessionLocal


async def get_db():
"""FastAPI Dependency Generator for Database"""
Expand Down
21 changes: 20 additions & 1 deletion api/src/deriver.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import asyncio
import os
import time
import uuid
from typing import List

Expand All @@ -15,6 +16,7 @@
from realtime.connection import Socket
from sqlalchemy import select
from sqlalchemy.orm import selectinload
from websockets.exceptions import ConnectionClosedError

from . import crud, models, schemas
from .db import SessionLocal
Expand All @@ -32,7 +34,7 @@
SUPABASE_ID = os.getenv("SUPABASE_ID")
SUPABASE_API_KEY = os.getenv("SUPABASE_API_KEY")

llm = ChatOpenAI(model_name="gpt-4")
llm = ChatOpenAI(model_name="gpt-3.5")
output_parser = NumberedListOutputParser()

SYSTEM_DERIVE_FACTS = load_prompt(
Expand Down Expand Up @@ -200,9 +202,26 @@ async def check_dups(
return new_facts


# def listen_to_websocket(url):
# while True:
# try:
# s = Socket(url)
# s.connect()
# channel = s.set_channel("realtime:public:messages")
# channel.join().on(
# "INSERT", lambda payload: asyncio.create_task(callback(payload))
# )

# s.listen()
# except ConnectionClosedError:
# print("Connection closed, attempting to reconnect...")
# time.sleep(5)


if __name__ == "__main__":
URL = f"wss://{SUPABASE_ID}.supabase.co/realtime/v1/websocket?apikey={SUPABASE_API_KEY}&vsn=1.0.0"
# URL = f"ws://127.0.0.1:54321/realtime/v1/websocket?apikey={SUPABASE_API_KEY}" # For local Supabase
# listen_to_websocket(URL)
s = Socket(URL)
s.connect()

Expand Down
Loading
Loading