bin/cohere-embed-v3-services.ts: Entry point for CDK deployment. It reads environment variables, checks them, and initializes the CDK stack for deployment.lib/CohereEmbedV3ServicesStackProps.tsand related files inlib/constructs: Define AWS infrastructure as code, including VPC, ECR, and App Runner configurations.package.jsonandpackage-lock.json: Define Node.js project dependencies, including AWS CDK libraries, TypeScript, and Jest for testing.tsconfig.json: TypeScript configuration file.
- Located in
src/coreservices/cohere-embed-v3, it includes a FastAPI applicationmain.pythat exposes endpoints for embedding text with Cohere's API. Dockerfileanddocker-compose.yml: Docker configurations for building and running the FastAPI application. Run on your local machine with commanddocker compose up --build -dand then checkout via:localhost:8090/docsrequirements.txt: Python dependencies for the FastAPI application, including FastAPI, Uvicorn, and Cohere's SDK.
You can deploy the stack from the following repository: AWS VPC Creator. After deployment, you can use the VPC_ID obtained from there as an input parameter.
Before running the application locally, you need to configure your environment variables:
- Copy the
.env.examplefile to a new file named.envin the same directory. - Open the
.envfile and fill in the values for the environment variables as per your setup. This includes setting up theCOHERE_API_KEY,DATA_INGESTION_API_KEY, and any other variables you might need to customize for your local development environment. - Ensure the
.envfile is correctly referenced in your application's configuration to load these environment variables.
To see a demo of the service running locally with Docker, refer to the screenshot below:
After deploying the service on AWS with App Runner, you can see the demo as shown in the screenshot below:

