Skip to content

Commit e55326f

Browse files
committed
Try setting api key directly on embeddings
1 parent f063d86 commit e55326f

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

app/api/v1/routes/auth.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,13 @@ async def api_keys(credentials: UserCredentials) -> ApiKeysResponse:
141141
Raises:
142142
HTTPException: 400 if listing fails, 401 if authentication fails
143143
"""
144+
print("Getting API Keys")
144145
try:
145146
user = await backend.authenticate_user(credentials.email, credentials.password)
146147
keys = await backend.list_api_keys(user)
147148
return ApiKeysResponse(api_keys=keys)
148149
except Exception as e:
150+
print(e)
149151
if isinstance(e, HTTPException):
150152
raise e
151153
raise HTTPException(status_code=400, detail=str(e))

app/core/security.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ async def create_user(email: str, password: str):
1717
})
1818

1919
async def authenticate_user(email: str, password: str):
20+
print("Auth'ing")
2021
session = db.auth.sign_in_with_password({
2122
"email": email,
2223
"password": password
2324
})
25+
print("Auth'ed")
2426
user = session.user
2527
if not user.user_metadata["email_verified"]:
2628
raise HTTPException(status_code=401, detail="Email not verified. Please check your inpox & spam")

app/services/clustering.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
11
from pydantic import BaseModel, Field
2-
from typing import List, Dict, Optional
2+
from typing import List
33
from openai import OpenAI
4-
import os
5-
from dataclasses import dataclass, asdict
64

75
from app.core.config import settings
86
from app.services.types import ClusterName, RankedIdea
97
from langchain_community.vectorstores import Chroma
108
from langchain_openai import OpenAIEmbeddings
11-
from langchain.text_splitter import RecursiveCharacterTextSplitter
129

1310

1411
async def summarize_clusters(ranked_ideas: List[RankedIdea]) -> List[ClusterName]:
1512

1613
print("Summarizing clusters")
17-
embeddings = OpenAIEmbeddings()
14+
embeddings = OpenAIEmbeddings(api_key=settings.OPENAI_API_KEY)
1815
vectordb = Chroma(embedding_function=embeddings)
1916

2017
# Add all ideas at once with metadata

0 commit comments

Comments
 (0)