Skip to content

Commit

Permalink
SSA code migration/refactoring incl foundational OODA problem-solving…
Browse files Browse the repository at this point in the history
… loop
  • Loading branch information
TheVinhLuong102 committed Nov 27, 2023
1 parent 127ffcb commit 610f170
Show file tree
Hide file tree
Showing 114 changed files with 1,490 additions and 1,491 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ current_version = 0.1.6
commit = False
tag = True

[bumpversion:file:openssm/VERSION]
[bumpversion:file:openssa/VERSION]

[bumpversion:file:pyproject.toml]

Expand Down
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: Pull request
about: Contribute to the OpenSSM project
about: Contribute to the SSA project

---

Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/make_test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Run Make Test on PRs
name: Run Make Test

on:
push:
branches:
- "*"

pull_request:
branches:
- "*"
Expand All @@ -13,6 +17,7 @@ jobs:
matrix:
python-version:
- '3.10'
- 3.11

steps:
- name: Checkout Repo
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,13 @@ package-lock.json
**/favicon/test
.env
.openssm
.openssa
__pycache__
/debug.py
/mkdocs.yml
/requirements.txt

tmp

# Streamlit secrets
secrets.toml
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This code of conduct outlines our expectations for all those who participate in our community, as well as the consequences for unacceptable behavior.

We invite all those who participate in OpenSSM to help us create safe and positive experiences for everyone.
We invite all those who participate in OpenSSA to help us create safe and positive experiences for everyone.

## Expected Behavior

Expand Down
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# Contributing to OpenSSM
# Contributing to OpenSSA

Thanks for your interest in contributing to OpenSSM! This document provides guidelines for contributing to the project. Please read these guidelines before submitting a contribution.
Thanks for your interest in contributing to OpenSSA! This document provides guidelines for contributing to the project. Please read these guidelines before submitting a contribution.

## Code of Conduct

All contributors must abide by the [Code of Conduct](CODE_OF_CONDUCT.md). Please read it before contributing.

## How to Contribute

1. **Find an issue to work on:** Look at the list of open issues in the OpenSSM repository. Pick one that interests you and that no one else is working on.
1. **Find an issue to work on:** Look at the list of open issues in the OpenSSA repository. Pick one that interests you and that no one else is working on.

2. **Fork the repository and create a branch:** If you're not a project maintainer, you'll need to create a fork of the repository and create a branch on your fork where you can make your changes.

3. **Submit a pull request:** After you've made your changes, submit a pull request to merge your branch into the main OpenSSM repository. Be sure to link the issue you're addressing in your pull request.
3. **Submit a pull request:** After you've made your changes, submit a pull request to merge your branch into the main OpenSSA repository. Be sure to link the issue you're addressing in your pull request.

Please ensure your contribution meets the following guidelines:

Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export OPENAI_API_URL?=DUMMY_OPENAI_API_URL
# Make sure we include the library directory
PROJECT_DIR=$(PWD)
ROOT_DIR=$(PROJECT_DIR)
LIB_DIR=$(PROJECT_DIR)/openssm
LIB_DIR=$(PROJECT_DIR)/openssa
TESTS_DIR=$(PROJECT_DIR)/tests
EXAMPLES_DIR=$(PROJECT_DIR)/examples
DIST_DIR=$(PROJECT_DIR)/dist
Expand Down Expand Up @@ -63,7 +63,7 @@ test-js:
cd $(TESTS_DIR) && npx jest


LINT_DIRS = openssm tests examples
LINT_DIRS = openssa tests examples
lint: lint-py lint-js

lint-py:
Expand Down Expand Up @@ -181,8 +181,8 @@ pip-install: requirements.txt

oss-publish:
@echo temporary target
# rsync -av --delete --dry-run ../ssm/ ../openssm/
rsync -av --exclude .git --delete ../ssm/ ../openssm/
# rsync -av --delete --dry-run ../ssa/ ../openssa/
rsync -av --exclude .git --delete ../ssa/ ../openssa/

#
# For web-based documentation
Expand Down
2 changes: 1 addition & 1 deletion docs/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
openssm/
openssa/
14 changes: 7 additions & 7 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
PROJECT_DIR := $(shell cd .. && pwd)
OPENSSM_DIR=$(PROJECT_DIR)/openssm
INIT_PY=$(OPENSSM_DIR)/__init__.py
TMP_INIT_PY=$(OPENSSM_DIR)/__tmp__init__.py
OPENSSA_DIR=$(PROJECT_DIR)/openssa
INIT_PY=$(OPENSSA_DIR)/__init__.py
TMP_INIT_PY=$(OPENSSA_DIR)/__tmp__init__.py
DOCS_DIR=$(PROJECT_DIR)/docs
SITE_DIR=$(PROJECT_DIR)/site
VERSION := $(shell cd $(OPENSSM_DIR) && cat VERSION)
VERSION := $(shell cd $(OPENSSA_DIR) && cat VERSION)

#MKDOCS=mkdocs -v
MKDOCS=mkdocs
PYTHONPATH=$(PROJECT_DIR):$(OPENSSM_DIR)
PYTHONPATH=$(PROJECT_DIR):$(OPENSSA_DIR)

# Colorized output
ANSI_NORMAL="\033[0m"
Expand All @@ -21,7 +21,7 @@ ANSI_CYAN="\033[0;36m"
ANSI_WHITE="\033[0;37m"


PYTHONPATH=$(PROJECT_DIR):$(OPENSSM_DIR)
PYTHONPATH=$(PROJECT_DIR):$(OPENSSA_DIR)


build:
Expand Down Expand Up @@ -65,7 +65,7 @@ copy-files:
@echo $(ANSI_GREEN) ... Generating our index.md from ../README.md $(ANSI_NORMAL)
sed -e 's#\(\.\./\)*docs/#/#g' ../README.md > index.md
@echo $(ANSI_GREEN) ... Working on other files $(ANSI_NORMAL)
FILE=openssm/integrations/llama_index/README.md ;\
FILE=openssa/integrations/llama_index/README.md ;\
sed -e 's#\.\./\(\.\./\)*docs/#/#g' $(PROJECT_DIR)/$$FILE > $(DOCS_DIR)/$$FILE

move-files:
Expand Down
10 changes: 5 additions & 5 deletions docs/api_nav.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@


DOCS_DIR = '.'
SRC_DIR = '../openssm'
API_DIR = './openssm'
SRC_DIR = '../openssa'
API_DIR = './openssa'
NAV_PATH = '/tmp/api_nav.yml'
MKDOCS_INC_PATH = DOCS_DIR + '/mkdocs.yml.inc'
MKDOCS_PATH = DOCS_DIR + '/../mkdocs.yml'

INDENT_SPACES = 2
MODULE_PATH_PREFIX = 'openssm/'
MODULE_PATH_PREFIX = 'openssa/'
EXCLUDES = ('deprecated', '__pycache__', '__init__.py')
EMPTY_MD = 'empty.md'

Expand Down Expand Up @@ -77,7 +77,7 @@ def generate_mkdocs_config(nav_path, src_dir, api_dir, indent_spaces):
empty_md_path = os.path.join(empty_md_dir, 'EMPTY.md')
with open(empty_md_path, 'w') as empty_md_file:
empty_md_file.write("This directory is (still) empty.\n")
nav_file.write(f'{indent}- {module_name}: openssm/{empty_md_path.replace(api_dir+"/", "")}\n')
nav_file.write(f'{indent}- {module_name}: openssa/{empty_md_path.replace(api_dir+"/", "")}\n')


else:
Expand All @@ -90,7 +90,7 @@ def generate_mkdocs_config(nav_path, src_dir, api_dir, indent_spaces):
module_path = os.path.join(root.replace(src_dir, '').lstrip('/'), file.replace('.py', ''))
nav_file.write(
f'{indent + " " * indent_spaces}- {file.replace(".py", "")}: '
f'openssm/{module_path.replace(".py", ".md")}.md\n')
f'openssa/{module_path.replace(".py", ".md")}.md\n')


def generate_api_reference(root, file, api_dir):
Expand Down
2 changes: 1 addition & 1 deletion docs/dev/design_principles.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# OpenSSM Design Principles
# A Design Principles

1. **Specialization Over Generalization:** Our models are designed to be domain-specific to provide precise solutions to specific problems, rather than providing generalized solutions.

Expand Down
6 changes: 3 additions & 3 deletions docs/mkdocs.yml.inc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
site_name: OpenSSM Documentation
site_name: OpenSSA Documentation

theme: windmill
#theme: material
Expand Down Expand Up @@ -39,7 +39,7 @@ plugins:
setup_commands:
- import os
- import sys
- sys.path.append('openssm')
- sys.path.append('openssa')
- sys.path.insert(0, os.path.abspath('.'))
- print(f"sys.path is {sys.pat}")
options:
Expand All @@ -52,7 +52,7 @@ nav:
- Using Makefile: dev/makefile_info.md
- Other HowTos: dev/howtos.md
- Integrations:
- LlamaIndex: openssm/integrations/llama_index/README.md
- LlamaIndex: openssa/integrations/llama_index/README.md
- Vectara: integrations/vectara.md
- Lepton.AI: integrations/lepton_ai.md
- Community:
Expand Down
1 change: 0 additions & 1 deletion docs/resources/favicon/test

This file was deleted.

2 changes: 1 addition & 1 deletion examples/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
**/tmp
.openssm
.openssa
token.json
2 changes: 1 addition & 1 deletion examples/chatssm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ APPNAME=$(notdir $(CURDIR))
# Make sure we include the library directory
PROJECT_DIR=.
ROOT_DIR=$(PROJECT_DIR)/../..
OPENSSM_DIR=$(ROOT_DIR)/openssm
OPENSSM_DIR=$(ROOT_DIR)/openssa
TESTS_DIR=$(ROOT_DIR)/tests
EXAMPLES_DIR=$(ROOT_DIR)/examples
PORT=8080
Expand Down
2 changes: 1 addition & 1 deletion examples/chatssm/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# OpenSSM/examples/chatssm/__init__.py
# OpenSSA/examples/chatssm/__init__.py
4 changes: 2 additions & 2 deletions examples/chatssm/config.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os
from openssm import Config
from openssa import Config


# Logging.set_log_level(logging.INFO)
Expand All @@ -10,7 +10,7 @@

# other config variables...

# These are already automatically done in the openssm/core/config.py file
# These are already automatically done in the openssa/core/config.py file
# Override them here if you want to use different values
# Config.OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
# Config.OPENAI_API_URL = os.getenv("OPENAI_API_URL")
Expand Down
2 changes: 1 addition & 1 deletion examples/chatssm/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from flask import render_template, request, Blueprint, session

from openssm import (
from openssa import (
BaseSSM,
OpenAIGPT3CompletionSSM, OpenAIGPT3ChatCompletionSSM,
Falcon7bSSM
Expand Down
6 changes: 3 additions & 3 deletions examples/integrations/lepton_ai.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
"metadata": {},
"outputs": [],
"source": [
"# Import OpenSSM package \"live\" from the source code\n",
"# Import OpenSSA package \"live\" from the source code\n",
"import sys\n",
"from pathlib import Path\n",
"sys.path.insert(0, str(Path('../../').resolve()))\n",
"\n",
"# Configure logging for some informative output\n",
"# from openssm import Logs, logger\n",
"# from openssa import Logs, logger\n",
"# logger.setLevel(logger.WARNING)"
]
},
Expand All @@ -31,7 +31,7 @@
"metadata": {},
"outputs": [],
"source": [
"from openssm import LeptonLlamaIndexSSM\n",
"from openssa import LeptonLlamaIndexSSM\n",
"ssm = LeptonLlamaIndexSSM(name=\"eos\")"
]
},
Expand Down
4 changes: 2 additions & 2 deletions examples/integrations/llama_index.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"import textwrap\n",
"\n",
"# Configure logging for some informative output\n",
"from openssm import logger, mlogger\n",
"from openssa import logger, mlogger\n",
"# mlogger.setLevel(logger.DEBUG)\n",
"# logger.setLevel(logger.DEBUG)\n",
"# logger.info(\"Working directory: %s\", Path.cwd())\n"
Expand All @@ -34,7 +34,7 @@
"metadata": {},
"outputs": [],
"source": [
"from openssm import LlamaIndexSSM\n",
"from openssa import LlamaIndexSSM\n",
"ssm = LlamaIndexSSM(name=\"phu\")\n",
"ssm.read_directory()"
]
Expand Down
23 changes: 0 additions & 23 deletions examples/integrations/mydocs.py

This file was deleted.

21 changes: 18 additions & 3 deletions examples/integrations/openai.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,25 @@
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"outputs": [
{
"ename": "ValueError",
"evalue": "model or engine must be provided (e.g., 'gpt-3.5-turbo'))",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[2], line 2\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39mopenssm\u001b[39;00m \u001b[39mimport\u001b[39;00m AzureGPT3ChatCompletionSSM\n\u001b[0;32m----> 2\u001b[0m ssm \u001b[39m=\u001b[39m AzureGPT3ChatCompletionSSM()\n",
"File \u001b[0;32m~/src/aitomatic/ssm/openssm/integrations/azure/ssm.py:70\u001b[0m, in \u001b[0;36mGPT3ChatCompletionSSM.__init__\u001b[0;34m(self, adapter, backends)\u001b[0m\n\u001b[1;32m 67\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39m__init__\u001b[39m(\u001b[39mself\u001b[39m,\n\u001b[1;32m 68\u001b[0m adapter: AbstractAdapter \u001b[39m=\u001b[39m \u001b[39mNone\u001b[39;00m,\n\u001b[1;32m 69\u001b[0m backends: \u001b[39mlist\u001b[39m[AbstractBackend] \u001b[39m=\u001b[39m \u001b[39mNone\u001b[39;00m):\n\u001b[0;32m---> 70\u001b[0m \u001b[39msuper\u001b[39m()\u001b[39m.\u001b[39m\u001b[39m__init__\u001b[39m(GPT3ChatCompletionSLM(), adapter, backends)\n",
"File \u001b[0;32m~/src/aitomatic/ssm/openssm/integrations/azure/ssm.py:63\u001b[0m, in \u001b[0;36mGPT3ChatCompletionSLM.__init__\u001b[0;34m(self, api_context, adapter)\u001b[0m\n\u001b[1;32m 59\u001b[0m api_context \u001b[39m=\u001b[39m APIContext\u001b[39m.\u001b[39mgpt3_defaults()\n\u001b[1;32m 61\u001b[0m api_context\u001b[39m.\u001b[39mis_chat_completion \u001b[39m=\u001b[39m \u001b[39mTrue\u001b[39;00m\n\u001b[0;32m---> 63\u001b[0m \u001b[39msuper\u001b[39;49m()\u001b[39m.\u001b[39;49m\u001b[39m__init__\u001b[39;49m(api_context, adapter\u001b[39m=\u001b[39;49madapter)\n",
"File \u001b[0;32m~/src/aitomatic/ssm/openssm/integrations/openai/ssm.py:65\u001b[0m, in \u001b[0;36m_AbstractSLM.__init__\u001b[0;34m(self, api_context, adapter)\u001b[0m\n\u001b[1;32m 62\u001b[0m \u001b[39mraise\u001b[39;00m \u001b[39mValueError\u001b[39;00m(\u001b[39m\"\u001b[39m\u001b[39mapi_key must be provided, e.g., via Config.OPENAI_API_KEY or \u001b[39m\u001b[39m'\u001b[39m\u001b[39msk-xxxxx\u001b[39m\u001b[39m'\u001b[39m\u001b[39m\"\u001b[39m)\n\u001b[1;32m 64\u001b[0m \u001b[39mif\u001b[39;00m api_context\u001b[39m.\u001b[39mmodel \u001b[39mis\u001b[39;00m \u001b[39mNone\u001b[39;00m \u001b[39mand\u001b[39;00m api_context\u001b[39m.\u001b[39mengine \u001b[39mis\u001b[39;00m \u001b[39mNone\u001b[39;00m:\n\u001b[0;32m---> 65\u001b[0m \u001b[39mraise\u001b[39;00m \u001b[39mValueError\u001b[39;00m(\u001b[39m\"\u001b[39m\u001b[39mmodel or engine must be provided (e.g., \u001b[39m\u001b[39m'\u001b[39m\u001b[39mgpt-3.5-turbo\u001b[39m\u001b[39m'\u001b[39m\u001b[39m))\u001b[39m\u001b[39m\"\u001b[39m)\n\u001b[1;32m 67\u001b[0m \u001b[39msuper\u001b[39m()\u001b[39m.\u001b[39m\u001b[39m__init__\u001b[39m(adapter)\n\u001b[1;32m 69\u001b[0m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_api_context \u001b[39m=\u001b[39m api_context\n",
"\u001b[0;31mValueError\u001b[0m: model or engine must be provided (e.g., 'gpt-3.5-turbo'))"
]
}
],
"source": [
"from openssm import GPT3ChatCompletionSSM\n",
"ssm = GPT3ChatCompletionSSM()"
"from openssm import AzureGPT3ChatCompletionSSM\n",
"ssm = AzureGPT3ChatCompletionSSM()"
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions examples/kbase/config.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import os
from openssm import Config
from openssa import Config


Config.FLASK_SECRET_KEY = os.environ.get(
'FLASK_SECRET_KEY') or '_5#8z\n\xec]/'

# other config variables...

# These are already automatically done in the openssm/core/config.py file
# These are already automatically done in the openssa/core/config.py file
# Override them here if you want to use different values
# Config.OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
# Config.OPENAI_API_URL = os.getenv("OPENAI_API_URL")
Expand Down
2 changes: 1 addition & 1 deletion examples/kbase/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from werkzeug.utils import secure_filename
from flask import render_template, request, Blueprint, session
from flask import Flask, jsonify
from openssm import (
from openssa import (
logger,
Logs,
BaseSSM,
Expand Down
Loading

0 comments on commit 610f170

Please sign in to comment.