Skip to content

Commit

Permalink
Merge pull request #873 from cheshire-cat-ai/develop
Browse files Browse the repository at this point in the history
Version 1.7.0
  • Loading branch information
pieroit authored Jul 19, 2024
2 parents 31cc1ee + c0cb4ad commit 4fe0738
Show file tree
Hide file tree
Showing 141 changed files with 5,354 additions and 2,849 deletions.
21 changes: 0 additions & 21 deletions .devcontainer/devcontainer.json

This file was deleted.

10 changes: 0 additions & 10 deletions .env.codespaces

This file was deleted.

6 changes: 5 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

# Protect endpoints with an access token
# CCAT_API_KEY=meow
# CCAT_API_KEY_WS=meow2

# self reload during development
# CCAT_DEBUG=true
Expand All @@ -27,4 +28,7 @@
# CCAT_SAVE_MEMORY_SNAPSHOTS=false

# CONFIG_FILE
# CCAT_METADATA_FILE="cat/data/metadata.json"
# CCAT_METADATA_FILE="cat/data/metadata.json"

# Set container timezone
# CCAT_TIMEZONE=Europe/Rome
33 changes: 8 additions & 25 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,20 @@ on:
branches: [main, develop]

jobs:
# pylint:
# name: "Coding Standards"
# runs-on: ubuntu-latest
# defaults:
# run:
# working-directory: ./core
# strategy:
# matrix:
# python-version: ["3.10"]
# steps:
# - name: Download
# uses: actions/checkout@v3
# - name: Prepare Python
# uses: actions/setup-python@v4
# with:
# python-version: ${{ matrix.python-version }}
# cache: 'pip'
# cache-dependency-path: pyproject.toml
# - name: Download python dependencies
# run: pip install .[dev]
# - name: Pylint
# run: pylint -f actions ./
linter:
name: "Run linter"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: chartboost/ruff-action@v1
test:
# needs: [ pylint ]
name: "Run Tests"
runs-on: 'ubuntu-latest'
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v2
- name: Cat up
run: docker-compose up -d
- name: Test
run: docker exec cheshire_cat_core python -m pytest --color=yes .
- name: Cat down
run: docker-compose down
run: docker-compose down
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ venv

.DS_Store
.idea
.vscode

# DBs
long_term_memory
Expand All @@ -33,9 +32,6 @@ core/cat/plugins/*
# plugins readme can stay
!core/cat/plugins/how-to-write-a-plugin.md

# tests plugin folder
plugin_folder

# cache embedder
core/local_cache/*

25 changes: 25 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
// VScode debug setup. Thanks to @sambarza
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Remote Attach to Cat",
"type": "python",
"request": "attach",
"connect": {
"host": "localhost",
"port": 5678
},
"pathMappings": [
{
"localRoot": "${workspaceFolder}/core",
"remoteRoot": "/app"
}
],
"justMyCode": true
}
]
}
File renamed without changes.
File renamed without changes.
19 changes: 13 additions & 6 deletions readme/CONTRIBUTING.md → CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,19 @@ All types of contributions are encouraged and valued. See the [Table of Contents
## Table of Contents

- [I Have a Question](#i-have-a-question)
- [I Want To Contribute](#i-want-to-contribute)
- [Reporting Bugs](#reporting-bugs)
- [Suggesting Enhancements](#suggesting-enhancements)
- [Your First Code Contribution](#your-first-code-contribution)
- [Improving The Documentation](#improving-the-documentation)
- [Contributing to Cheshire Cat](#contributing-to-cheshire-cat)
- [Table of Contents](#table-of-contents)
- [I Have a Question](#i-have-a-question)
- [I Want To Contribute](#i-want-to-contribute)
- [Reporting Bugs](#reporting-bugs)
- [Before Submitting a Bug Report](#before-submitting-a-bug-report)
- [How Do I Submit a Good Bug Report?](#how-do-i-submit-a-good-bug-report)
- [Suggesting Enhancements](#suggesting-enhancements)
- [Before Submitting an Enhancement](#before-submitting-an-enhancement)
- [How Do I Submit a Good Enhancement Suggestion?](#how-do-i-submit-a-good-enhancement-suggestion)
- [Your First Code Contribution](#your-first-code-contribution)
- [Improving The Documentation](#improving-the-documentation)
- [Attribution](#attribution)

## I Have a Question

Expand Down
File renamed without changes.
7 changes: 6 additions & 1 deletion compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '3.7'

services:

Expand All @@ -11,6 +10,12 @@ services:
# - .env
ports:
- ${CCAT_CORE_PORT:-1865}:80
- 5678:5678 # only for development purposes (take away in production)
extra_hosts:
- "host.docker.internal:host-gateway" # This add an entry to /etc/hosts file in the container mapping host.docker.internal to the host machine IP addr, allowing the container to access services running on the host, not only on Win and Mac but also Linux. See https://docs.docker.com/desktop/networking/#i-want-to-connect-from-a-container-to-a-service-on-the-host and https://docs.docker.com/reference/cli/docker/container/run/#add-host
environment:
# Timezone
- TZ=${CCAT_TIMEZONE:-UTC}
volumes:
- ./core:/app
command:
Expand Down
39 changes: 39 additions & 0 deletions core/cat/agents/base_agent.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
from typing import List
from abc import ABC, abstractmethod

from langchain_core.utils import get_colored_text

from cat.utils import BaseModelDict

class AgentOutput(BaseModelDict):
output: str
intermediate_steps: List = []
return_direct: bool = False


class BaseAgent(ABC):

@abstractmethod
async def execute(*args, **kwargs) -> AgentOutput:
pass

# TODO: this is here to debug langchain, take it away
def _log_prompt(self, langchain_prompt, title):
print("\n")
print(get_colored_text(f"==================== {title} ====================", "green"))
for m in langchain_prompt.messages:
print(get_colored_text(type(m).__name__, "green"))
print(m.content)
print(get_colored_text("========================================", "green"))
return langchain_prompt

# TODO: this is here to debug langchain, take it away
def _log_output(self, langchain_output, title):
print("\n")
print(get_colored_text(f"==================== {title} ====================", "blue"))
if hasattr(langchain_output, 'content'):
print(langchain_output.content)
else:
print(langchain_output)
print(get_colored_text("========================================", "blue"))
return langchain_output
Loading

0 comments on commit 4fe0738

Please sign in to comment.