This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Install required modules and set the envvar for Gemini API Key | |
#pip install google.generativeai | |
#pip install langchain-google-genai | |
#pip install langchain | |
#pip install langchain_community | |
#pip install jupyter | |
#export GOOGLE_API_KEY="YOUR_GOOGLE_API_KEY" | |
#Import Modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Install required modules and set the envvar for Gemini API Key | |
#pip install pypdf2 | |
#pip install chromadb | |
#pip install google.generativeai | |
#pip install langchain-google-genai | |
#pip install langchain | |
#pip install langchain_community | |
#pip install jupyter | |
#export GOOGLE_API_KEY="YOUR_GOOGLE_API_KEY" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The previous part of this tutorial is at https://gist.github.com/janakiramm/55d2d8ec5d14dd45c7e9127d81cdafcd | |
from vertexai.language_models import TextEmbeddingModel | |
from google.cloud import aiplatform | |
import vertexai | |
from vertexai.preview.generative_models import GenerativeModel, Part | |
import json | |
import os | |
project=”YOUR_GCP_PROJECT” |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###Enable Google Cloud APIs and login with your credentials | |
#gcloud services enable compute.googleapis.com aiplatform.googleapis.com storage.googleapis.com | |
#gcloud auth application-default login | |
###Install required Python modules | |
#pip install pypdf2 | |
#pip install google-cloud-storage | |
#pip install google-cloud-aiplatform | |
#pip install jupyter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import openai | |
import chromadb | |
from chromadb.utils import embedding_functions | |
import os | |
df=pd.read_csv('./data/oscars.csv') | |
df=df.loc[df['year_ceremony'] == 2023] | |
df=df.dropna(subset=['film']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import chromadb | |
phrases=[ | |
"Amanda baked cookies and will bring Jerry some tomorrow.", | |
"Olivia and Olivier are voting for liberals in this election.", | |
"Sam is confused, because he overheard Rick complaining about him as a roommate. Naomi thinks Sam should talk to Rick. Sam is not sure what to do.", | |
"John's cookies were only half-baked but he still carries them for Mary.", | |
] | |
ids=["001","002","003","004"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import openai | |
import tiktoken | |
from scipy import spatial | |
import pandas as pd | |
df=pd.read_csv('./data/oscars.csv') | |
print(df.head()) | |
df=df.loc[df['year_ceremony'] == 2023] | |
df=df.dropna(subset=['film']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: kustomize.toolkit.fluxcd.io/v1beta1 | |
kind: Kustomization | |
metadata: | |
name: app | |
namespace: flux-system | |
spec: | |
interval: 1m | |
sourceRef: | |
kind: GitRepository | |
name: flux-system |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: networking.k8s.io/v1 | |
kind: Ingress | |
metadata: | |
name: mywebapp-ingress | |
namespace: mywebapp | |
annotations: | |
kubernetes.io/ingress.class: nginx | |
spec: | |
rules: | |
- http: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: web | |
namespace: mywebapp | |
labels: | |
name: web | |
app: mywebapp | |
spec: | |
selector: |
NewerOlder