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

Move getting started & .env to each project #20

Merged
merged 2 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 0 additions & 2 deletions .env.example

This file was deleted.

27 changes: 16 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
- cron: "17 12 * * *"

jobs:
test-table-of-contents-up-to-date:
test-readmes-up-to-date:
runs-on: ubuntu-latest

steps:
Expand All @@ -25,16 +25,16 @@ jobs:
with:
node-version: 20

- name: Make table of contents
run: node tools/make-toc.js
- name: Make READMEs
run: node tools/make-readmes.js

- name: Ensure table of contents is up to date
- name: Ensure READMEs are up to date
run: |
if [[ -n $(git status --porcelain) ]]; then
echo "::error::The table of contents is out of date. Please run 'node tools/make-toc.js' and commit the changes."
echo "::error::The READMEs are out of date. Please run 'node tools/make-readmes.js' and commit the changes."
exit 1
else
echo "Table of contents is up to date!"
echo "READMEs are up to date!"
fi

test-python:
Expand All @@ -47,6 +47,11 @@ jobs:
- Python/openai-manual
- Python/openai-automated

defaults:
run:
shell: bash
working-directory: ${{ matrix.project }}

steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -67,15 +72,12 @@ jobs:

- name: Check pyproject.toml & poetry.lock are in sync
run: poetry lock --check
working-directory: ${{ matrix.project }}

- name: Install dependencies
run: poetry install
working-directory: ${{ matrix.project }}

- name: Run script
run: poetry run python main.py
working-directory: ${{ matrix.project }}

test-javascript:
runs-on: ubuntu-latest
Expand All @@ -89,6 +91,11 @@ jobs:
- JavaScript/openai-automated
- JavaScript/openai-manual

defaults:
run:
shell: bash
working-directory: ${{ matrix.project }}

steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -106,11 +113,9 @@ jobs:

- name: Install dependencies
run: npm ci
working-directory: ${{ matrix.project }}

- name: Run script
run: npm run start
working-directory: ${{ matrix.project }}

notify:
needs:
Expand Down
20 changes: 13 additions & 7 deletions JavaScript/chatbot-nextjs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,28 @@
🏠
<a href="https://www.autoblocks.ai/">Home</a>
</p>
<p align="center">
:bangbang:
Make sure you've read the <a href="/README.md#getting-started">getting started</a> section in the main README.
</p>
<!-- banner end -->

# Chatbot Example

This is a Next.js app that uses openai and Autoblocks to power and monitor a chatbot.

View the deployed application at https://chatbot-example.autoblocks.ai

## Copy the root `.env` file to this directory
<!-- getting started start -->
## Getting started

```bash
cp ../../.env .
- Sign up for an Autoblocks account at https://app.autoblocks.ai
- Grab your Autoblocks ingestion key from https://app.autoblocks.ai/settings/api-keys
- Grab your OpenAI API key from https://platform.openai.com/account/api-keys
- Create a file named `.env` in this folder and include the following environment variables:

`.env`
```
OPENAI_API_KEY=<your-api-key>
AUTOBLOCKS_INGESTION_KEY=<your-ingestion-key>
```
<!-- getting started end -->

## Install dependencies

Expand Down
19 changes: 15 additions & 4 deletions JavaScript/langchain/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,23 @@
🏠
<a href="https://www.autoblocks.ai/">Home</a>
</p>
<p align="center">
:bangbang:
Make sure you've read the <a href="/README.md#getting-started">getting started</a> section in the main README.
</p>
<!-- banner end -->

<!-- getting started start -->
## Getting started

- Sign up for an Autoblocks account at https://app.autoblocks.ai
- Grab your Autoblocks ingestion key from https://app.autoblocks.ai/settings/api-keys
- Grab your OpenAI API key from https://platform.openai.com/account/api-keys
- Create a file named `.env` in this folder and include the following environment variables:

`.env`
```
OPENAI_API_KEY=<your-api-key>
AUTOBLOCKS_INGESTION_KEY=<your-ingestion-key>
```
<!-- getting started end -->

## Install dependencies

```
Expand Down
2 changes: 1 addition & 1 deletion JavaScript/langchain/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"type": "module",
"scripts": {
"start": "dotenv -e ../../.env -- node ./src/index.js"
"start": "dotenv -e .env -- node ./src/index.js"
},
"author": "",
"license": "MIT",
Expand Down
19 changes: 12 additions & 7 deletions JavaScript/novel-ai-text-editor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,26 @@
🏠
<a href="https://www.autoblocks.ai/">Home</a>
</p>
<p align="center">
:bangbang:
Make sure you've read the <a href="/README.md#getting-started">getting started</a> section in the main README.
</p>
<!-- banner end -->

# Novel Example

Example Next.js application using [Novel](https://github.com/steven-tey/novel). Based on [novella](https://github.com/steven-tey/novella).

## Copy the root `.env` file to this directory
<!-- getting started start -->
## Getting started

```bash
cp ../../.env .
- Sign up for an Autoblocks account at https://app.autoblocks.ai
- Grab your Autoblocks ingestion key from https://app.autoblocks.ai/settings/api-keys
- Grab your OpenAI API key from https://platform.openai.com/account/api-keys
- Create a file named `.env` in this folder and include the following environment variables:

`.env`
```
OPENAI_API_KEY=<your-api-key>
AUTOBLOCKS_INGESTION_KEY=<your-ingestion-key>
```
<!-- getting started end -->

## Install Dependencies

Expand Down
19 changes: 15 additions & 4 deletions JavaScript/openai-automated/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,23 @@
🏠
<a href="https://www.autoblocks.ai/">Home</a>
</p>
<p align="center">
:bangbang:
Make sure you've read the <a href="/README.md#getting-started">getting started</a> section in the main README.
</p>
<!-- banner end -->

<!-- getting started start -->
## Getting started

- Sign up for an Autoblocks account at https://app.autoblocks.ai
- Grab your Autoblocks ingestion key from https://app.autoblocks.ai/settings/api-keys
- Grab your OpenAI API key from https://platform.openai.com/account/api-keys
- Create a file named `.env` in this folder and include the following environment variables:

`.env`
```
OPENAI_API_KEY=<your-api-key>
AUTOBLOCKS_INGESTION_KEY=<your-ingestion-key>
```
<!-- getting started end -->

## Install Dependencies

```
Expand Down
2 changes: 1 addition & 1 deletion JavaScript/openai-automated/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"type": "module",
"main": "src/index.js",
"scripts": {
"start": "dotenv -e ../../.env -- node ./src/index.js"
"start": "dotenv -e .env -- node ./src/index.js"
},
"license": "MIT",
"dependencies": {
Expand Down
19 changes: 15 additions & 4 deletions JavaScript/openai-manual/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,23 @@
🏠
<a href="https://www.autoblocks.ai/">Home</a>
</p>
<p align="center">
:bangbang:
Make sure you've read the <a href="/README.md#getting-started">getting started</a> section in the main README.
</p>
<!-- banner end -->

<!-- getting started start -->
## Getting started

- Sign up for an Autoblocks account at https://app.autoblocks.ai
- Grab your Autoblocks ingestion key from https://app.autoblocks.ai/settings/api-keys
- Grab your OpenAI API key from https://platform.openai.com/account/api-keys
- Create a file named `.env` in this folder and include the following environment variables:

`.env`
```
OPENAI_API_KEY=<your-api-key>
AUTOBLOCKS_INGESTION_KEY=<your-ingestion-key>
```
<!-- getting started end -->

## Install Dependencies

```
Expand Down
2 changes: 1 addition & 1 deletion JavaScript/openai-manual/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "module",
"main": "src/index.js",
"scripts": {
"start": "dotenv -e ../../.env -- node ./src/index.js"
"start": "dotenv -e .env -- node ./src/index.js"
},
"license": "MIT",
"dependencies": {
Expand Down
19 changes: 15 additions & 4 deletions Python/langchain/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,23 @@
🏠
<a href="https://www.autoblocks.ai/">Home</a>
</p>
<p align="center">
:bangbang:
Make sure you've read the <a href="/README.md#getting-started">getting started</a> section in the main README.
</p>
<!-- banner end -->

<!-- getting started start -->
## Getting started

- Sign up for an Autoblocks account at https://app.autoblocks.ai
- Grab your Autoblocks ingestion key from https://app.autoblocks.ai/settings/api-keys
- Grab your OpenAI API key from https://platform.openai.com/account/api-keys
- Create a file named `.env` in this folder and include the following environment variables:

`.env`
```
OPENAI_API_KEY=<your-api-key>
AUTOBLOCKS_INGESTION_KEY=<your-ingestion-key>
```
<!-- getting started end -->

## Install dependencies

```bash
Expand Down
2 changes: 1 addition & 1 deletion Python/langchain/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from langchain.llms import OpenAI
from langchain.prompts import PromptTemplate

dotenv.load_dotenv("../../.env")
dotenv.load_dotenv(".env")


if __name__ == "__main__":
Expand Down
21 changes: 16 additions & 5 deletions Python/openai-automated/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,24 @@
🏠
<a href="https://www.autoblocks.ai/">Home</a>
</p>
<p align="center">
:bangbang:
Make sure you've read the <a href="/README.md#getting-started">getting started</a> section in the main README.
</p>
<!-- banner end -->

## Install dependencies:
<!-- getting started start -->
## Getting started

- Sign up for an Autoblocks account at https://app.autoblocks.ai
- Grab your Autoblocks ingestion key from https://app.autoblocks.ai/settings/api-keys
- Grab your OpenAI API key from https://platform.openai.com/account/api-keys
- Create a file named `.env` in this folder and include the following environment variables:

`.env`
```
OPENAI_API_KEY=<your-api-key>
AUTOBLOCKS_INGESTION_KEY=<your-ingestion-key>
```
<!-- getting started end -->

## Install dependencies

```bash
poetry install
Expand Down
2 changes: 1 addition & 1 deletion Python/openai-automated/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Environment variables need to be loaded before we import
# trace_openai and openai
dotenv.load_dotenv("../../.env")
dotenv.load_dotenv(".env")

from autoblocks.vendor.openai import trace_openai
import openai
Expand Down
21 changes: 16 additions & 5 deletions Python/openai-manual/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,24 @@
🏠
<a href="https://www.autoblocks.ai/">Home</a>
</p>
<p align="center">
:bangbang:
Make sure you've read the <a href="/README.md#getting-started">getting started</a> section in the main README.
</p>
<!-- banner end -->

## Install dependencies:
<!-- getting started start -->
## Getting started

- Sign up for an Autoblocks account at https://app.autoblocks.ai
- Grab your Autoblocks ingestion key from https://app.autoblocks.ai/settings/api-keys
- Grab your OpenAI API key from https://platform.openai.com/account/api-keys
- Create a file named `.env` in this folder and include the following environment variables:

`.env`
```
OPENAI_API_KEY=<your-api-key>
AUTOBLOCKS_INGESTION_KEY=<your-ingestion-key>
```
<!-- getting started end -->

## Install dependencies

```bash
poetry install
Expand Down
2 changes: 1 addition & 1 deletion Python/openai-manual/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import openai
from autoblocks.tracer import AutoblocksTracer

dotenv.load_dotenv("../../.env")
dotenv.load_dotenv(".env")

openai.api_key = os.environ["OPENAI_API_KEY"]

Expand Down
Loading