diff --git a/README.md b/README.md index ea88dbc..d4c76de 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,10 @@ If you want to use Terraform and AWS see [this tutorial](RUNNING_TERRAFORM_AWS.m docker-compose up -d ``` -### Execute the timeless-api +### Execute the timeless-api +Run using OpenAI or Ollama. + +#### Using OpenAPI > [!NOTE] > Before you start, make sure to fill the `quarkus.langchain4j.openai.api-key` and `quarkus.langchain4j.openai.gpt-4-turbo.api-key` variables in the `timeless/src/main/resources/application.properties` file. @@ -85,6 +88,20 @@ docker-compose up -d 3. Sign in at http://localhost:8080 + +#### Using Ollama + +1. Go to `timeless-api` directory and execute: + +```shell +./mvnw quarkus:dev -Pollama -Dquarkus.profile=local +``` + +2. Sign up at http://localhost:8080/sign-up + +3. Sign in at http://localhost:8080 + + ### Execute the whatsapp application > [!NOTE] diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml index 5b1e8a2..0269e3d 100644 --- a/docker/docker-compose.yaml +++ b/docker/docker-compose.yaml @@ -26,3 +26,9 @@ services: - POSTGRES_DB=quarkus volumes: - ./postgres-data:/var/lib/postgresql/data + + ollama: + image: ollama/ollama:latest + container_name: ollama + ports: + - "11434:11434" \ No newline at end of file diff --git a/timeless-api/pom.xml b/timeless-api/pom.xml index b979a85..4bfd696 100644 --- a/timeless-api/pom.xml +++ b/timeless-api/pom.xml @@ -62,11 +62,6 @@ quarkus-quinoa ${quarkus-quinoa.version} - - io.quarkiverse.langchain4j - quarkus-langchain4j-openai - ${quarkus-langchain4j-openai.version} - io.quarkiverse.amazonservices quarkus-amazon-sqs @@ -219,5 +214,28 @@ true + + openai + + true + + + + io.quarkiverse.langchain4j + quarkus-langchain4j-openai + ${quarkus-langchain4j-openai.version} + + + + + ollama + + + io.quarkiverse.langchain4j + quarkus-langchain4j-ollama + ${quarkus-langchain4j-openai.version} + + + diff --git a/timeless-api/src/main/resources/application.properties b/timeless-api/src/main/resources/application.properties index 219f81e..f6c765b 100644 --- a/timeless-api/src/main/resources/application.properties +++ b/timeless-api/src/main/resources/application.properties @@ -19,8 +19,10 @@ quarkus.hibernate-orm.schema-management.strategy=update %dev.quarkus.hibernate-orm.dev-ui.allow-hql=true # ai -quarkus.langchain4j.openai.api-key=${OPENAI_API_KEY:unused} -quarkus.langchain4j.openai.gpt-4-turbo.api-key=${OPENAI_API_KEY:unused} +%dev.quarkus.langchain4j.openai.api-key=${OPENAI_API_KEY} +%dev.quarkus.langchain4j.openai.gpt-4-turbo.api-key=${OPENAI_API_KEY} +%local.quarkus.langchain4j.ollama.base-url=http://localhost:11434/ +%local.quarkus.langchain4j.ollama.chat-model.model-id=llama3.2-vision:11b # quinoa (frontend) quarkus.quinoa.enable-spa-routing=true diff --git a/whatsapp/.env.local b/whatsapp/.env.local index ca21a2c..6bdd22d 100644 --- a/whatsapp/.env.local +++ b/whatsapp/.env.local @@ -3,6 +3,6 @@ AWS_SECRET_ACCESS_KEY=test AWS_REGION=us-east-1 ASSETS_BUCKET=timeless-local-assets INCOMING_MESSAGE_FIFO_URL=http://localhost:4566/000000000000/incoming-messages.fifo -RECOGNIZED_MESSAGES_FIFO_URL=http://localhost:4566/000000000000/messages-processed.fifo +RECOGNIZED_MESSAGE_FIFO_URL=http://localhost:4566/000000000000/messages-processed.fifo ALLOWED_PHONE_NUMBERS= OPENAI_API_KEY= \ No newline at end of file