I have created a solution to the problem of getting the app to run on MacOS 14, Intel chip
I checked the dependencies that were causing torch to be needed. This was in sentencetransformers.
The sentencetransformers lib is only used as the embedding model for the vector database. So I took out sentencetransformers, and used OpenAI instead.
The changes are in vector_store.py, which now looks like:
import chromadb
from chromadb.config import Settings
from typing import List, Dict, Any, Optional
from dataclasses import dataclass
from models import Course, CourseChunk
from chromadb.utils.embedding_functions import OpenAIEmbeddingFunction
@dataclass
class SearchResults:
“”“Container for search results with metadata”“”
documents: List[str]
metadata: List[Dict[str, Any]]
distances: List[float]
error: Optional[str] = None
@classmethod
def from_chroma(cls, chroma_results: Dict) -> 'SearchResults':
"""Create SearchResults from ChromaDB query results"""
return cls(
documents=chroma_results\['documents'\]\[0\] if chroma_results\['documents'\] else \[\],
metadata=chroma_results\['metadatas'\]\[0\] if chroma_results\['metadatas'\] else \[\],
distances=chroma_results\['distances'\]\[0\] if chroma_results\['distances'\] else \[\]
)
@classmethod
def empty(cls, error_msg: str) -> 'SearchResults':
"""Create empty results with error message"""
return cls(documents=\[\], metadata=\[\], distances=\[\], error=error_msg)
def is_empty(self) -> bool:
"""Check if results are empty"""
return len(self.documents) == 0
class VectorStore:
“”“Vector storage using ChromaDB for course content and metadata”“”
def \__init_\_(self, openai_api_key: str, chroma_path: str, max_results: int = 5):
self.max_results = max_results
# Initialize ChromaDB client
self.client = chromadb.PersistentClient(
path=chroma_path,
settings=Settings(anonymized_telemetry=False)
)
self.embedding_function = OpenAIEmbeddingFunction(
api_key=openai_api_key,
model_name="text-embedding-3-small"
)
# Create collections for different types of data
self.course_catalog = self.\_create_collection("course_catalog") # Course titles/instructors
self.course_content = self.\_create_collection("course_content") # Actual course material
And the requirements specified in pyproject.py are now:
project
name = “starting-codebase”
version = “0.1.0”
description = “Add your description here”
readme = “README.md”
requires-python = “>=3.13”
dependencies = [
“chromadb==1.0.15”,
“anthropic”,
“openai”,
“fastapi==0.116.1”,
“uvicorn==0.35.0”,
“python-multipart==0.0.20”,
“python-dotenv==1.1.1”
]
-
You will need an openAI_API_KEY
Now the app is running for me, and I am proceeding with the course.