Skip to content

Instantly share code, notes, and snippets.

View Caellwyn's full-sized avatar
🏠
Working from home

John Johnson Caellwyn

🏠
Working from home
View GitHub Profile
@Caellwyn
Caellwyn / AIAgent.py
Created June 9, 2023 17:06
An AIAgent class to interact with ChatGPT via API
import openai
import streamlit
openai.api_key = streamlit.secrets['OPENAI_API_KEY']
class AIAgent():
def __init__(self, model="gpt-3.5-turbo"):
self.model=model
self.system_message = """For each query, consider writings by philosophers that have addressed that question and choose one.
Respond to the query from the point of view of that philosopher
Finally, use those referenced sources to form a response to the query that the chosen philosopher would support.
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from keras import regularizers, optimizers
from keras.layers import Dense, Dropout, Input
from keras.models import Sequential, load_model
from keras.callbacks import ModelCheckpoint
from keras.datasets import boston_housing
from keras.losses import MeanSquaredError
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Caellwyn
Caellwyn / pandas_groupby_example.ipynb
Last active October 10, 2021 11:15
Pandas df.groupby() Example
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Caellwyn
Caellwyn / Using Pre-trained Embedding Layer Weights from SpaCy for NLP
Last active April 27, 2022 02:11
Using Pre-trained Embedding Layer Weights from SpaCy for NLP
import pandas as pd
import numpy as np
from keras import regularizers, optimizers
from keras.layers.experimental.preprocessing import TextVectorization
from keras.layers import Embedding, Dense, Dropout, Input, LSTM, GlobalMaxPool1D
from keras.models import Sequential
from keras.initializers import Constant
import tensorflow as tf
import spacy
@Caellwyn
Caellwyn / fb_model.ipynb
Last active January 23, 2021 13:14
fb_model.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Caellwyn
Caellwyn / facebook_prophet_prepare_data.ipynb
Last active January 22, 2021 16:41
facebook_prophet_prepare_data.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Caellwyn
Caellwyn / dash-example-src.ipynb
Last active January 9, 2021 17:07
dash-example-src.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Caellwyn
Caellwyn / dash-example.ipynb
Last active January 9, 2021 17:26
dash-example.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Caellwyn
Caellwyn / sarima_model_demonstration.ipynb
Last active January 8, 2021 17:54
SARIMA_model_demonstration.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.