### Install Project Dependencies Source: https://github.com/deepgram-starters/java-text-intelligence/blob/main/AGENTS.md Commands to resolve Maven dependencies for the backend and install Node.js dependencies for the frontend. ```bash mvn dependency:resolve Frontend: cd frontend && corepack pnpm install ``` -------------------------------- ### Manage Application Lifecycle Source: https://github.com/deepgram-starters/java-text-intelligence/blob/main/AGENTS.md Commands for starting, stopping, and rebuilding the application environment. ```bash make start ``` ```bash # Terminal 1 — Backend mvn compile exec:java # Terminal 2 — Frontend cd frontend && corepack pnpm run dev -- --port 8080 --no-open ``` ```bash lsof -ti:8080,8081 | xargs kill -9 2>/dev/null ``` ```bash rm -rf target frontend/node_modules frontend/.vite make init ``` -------------------------------- ### Initialize and Start the Application Source: https://github.com/deepgram-starters/java-text-intelligence/blob/main/AGENTS.md Commands to initialize the project submodules, configure environment variables, and launch the backend and frontend servers. ```bash # Initialize (clone submodules + install deps) make init # Set up environment test -f .env || cp sample.env .env # then set DEEPGRAM_API_KEY # Start both servers make start # Backend: http://localhost:8081 # Frontend: http://localhost:8080 ``` -------------------------------- ### Conventional Commits Examples Source: https://github.com/deepgram-starters/java-text-intelligence/blob/main/AGENTS.md Examples of commit messages following the conventional commits format. Use these to maintain a consistent commit history. ```bash feat(java-text-intelligence): add diarization support ``` ```bash fix(java-text-intelligence): resolve WebSocket close handling ``` ```bash refactor(java-text-intelligence): simplify session endpoint ``` ```bash chore(deps): update frontend submodule ``` -------------------------------- ### Initialize and Start Java App Source: https://github.com/deepgram-starters/java-text-intelligence/blob/main/README.md Use these commands to set up your local environment and run the Java Text Intelligence demo application. Ensure you have your DEEPGRAM_API_KEY configured in the .env file. ```bash make init cp sample.env .env # Add your DEEPGRAM_API_KEY make start ``` -------------------------------- ### GET /api/metadata Source: https://github.com/deepgram-starters/java-text-intelligence/blob/main/AGENTS.md Returns application metadata including the use case, framework, and programming language. ```APIDOC ## GET /api/metadata ### Description Returns app metadata such as the use case, framework, and language. ### Method GET ### Endpoint /api/metadata ``` -------------------------------- ### Error Handling Source: https://context7.com/deepgram-starters/java-text-intelligence/llms.txt Examples of API error responses for authentication issues, validation errors, and deprecated features. ```bash TOKEN=$(curl -s http://localhost:8081/api/session | jq -r '.token') # Missing authentication curl -X POST "http://localhost:8081/api/text-intelligence" \ -H "Content-Type: application/json" \ -d '{"text": "Hello"}' | jq # Invalid/expired token curl -X POST "http://localhost:8081/api/text-intelligence" \ -H "Authorization: Bearer invalid_token" \ -H "Content-Type: application/json" \ -d '{"text": "Hello"}' | jq # Missing text or url curl -X POST "http://localhost:8081/api/text-intelligence" \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{}' | jq # Both text and url provided (invalid) curl -X POST "http://localhost:8081/api/text-intelligence" \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{"text": "Hello", "url": "https://example.com"}' | jq # Deprecated summarize v1 curl -X POST "http://localhost:8081/api/text-intelligence?summarize=v1" \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{"text": "Hello"}' | jq ``` -------------------------------- ### GET /api/session Source: https://github.com/deepgram-starters/java-text-intelligence/blob/main/AGENTS.md Issues a JWT session token for authenticated requests. ```APIDOC ## GET /api/session ### Description Issues a JWT session token for use in subsequent authenticated API requests. ### Method GET ### Endpoint /api/session ``` -------------------------------- ### GET /api/metadata - Retrieve Application Metadata Source: https://context7.com/deepgram-starters/java-text-intelligence/llms.txt Returns metadata from the `deepgram.toml` configuration file including use case, framework, and language information. ```APIDOC ## GET /api/metadata - Retrieve Application Metadata ### Description Returns metadata from the `deepgram.toml` configuration file including use case, framework, and language information. ### Method GET ### Endpoint /api/metadata ### Request Example ```bash curl -s http://localhost:8081/api/metadata | jq ``` ### Response #### Success Response (200) - **title** (string) - The title of the application. - **description** (string) - A brief description of the application. - **author** (string) - The author of the application. - **repository** (string) - The URL of the application's repository. - **useCase** (string) - The primary use case of the application. - **language** (string) - The programming language used. - **framework** (string) - The web framework used. - **sdk** (string) - The SDK used (if any). - **tags** (array of strings) - Tags associated with the application. #### Response Example ```json { "title": "Java Text Intelligence Starter", "description": "Get started using Deepgram's Text Intelligence with this Java demo app", "author": "Deepgram DX Team (https://developers.deepgram.com)", "repository": "https://github.com/deepgram-starters/java-text-intelligence", "useCase": "text-intelligence", "language": "Java", "framework": "Javalin", "sdk": "N/A", "tags": ["text-intelligence", "text-analysis", "summarization", "topics", "sentiment", "java", "javalin"] } ``` ``` -------------------------------- ### GET /health - Health Check Endpoint Source: https://context7.com/deepgram-starters/java-text-intelligence/llms.txt Returns the health status of the service for monitoring and load balancer health checks. ```APIDOC ## GET /health - Health Check Endpoint ### Description Returns the health status of the service for monitoring and load balancer health checks. ### Method GET ### Endpoint /health ### Request Example ```bash curl -s http://localhost:8081/health | jq ``` ### Response #### Success Response (200) - **status** (string) - The health status of the service (e.g., "ok"). - **service** (string) - The name of the service. #### Response Example ```json { "status": "ok", "service": "text-intelligence" } ``` ``` -------------------------------- ### GET /api/session - Obtain JWT Token Source: https://context7.com/deepgram-starters/java-text-intelligence/llms.txt Issues a signed JWT session token valid for 1 hour. This token must be included in the Authorization header for protected endpoints. ```APIDOC ## GET /api/session - Obtain JWT Token ### Description Issues a signed JWT session token valid for 1 hour. This token must be included in the Authorization header for protected endpoints. ### Method GET ### Endpoint /api/session ### Request Example ```bash curl -s http://localhost:8081/api/session | jq ``` ### Response #### Success Response (200) - **token** (string) - The JWT session token. #### Response Example ```json { "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE3MDk4..." } ``` ``` -------------------------------- ### Initialize and Run Project with Makefile Source: https://context7.com/deepgram-starters/java-text-intelligence/llms.txt Use these commands to set up dependencies, configure the environment, and launch the backend and frontend servers. ```bash # Initialize submodules and install dependencies make init # Configure environment cp sample.env .env # Edit .env and set: DEEPGRAM_API_KEY=your_api_key_here # Start both backend and frontend servers make start # Or start individually make start-backend # Backend on http://localhost:8081 make start-frontend # Frontend on http://localhost:8080 ``` -------------------------------- ### Configure Environment Variables Source: https://context7.com/deepgram-starters/java-text-intelligence/llms.txt Define required API keys and optional server settings in the .env file. ```bash # Required - Deepgram API key from https://console.deepgram.com DEEPGRAM_API_KEY=your_api_key_here # Optional - Backend server configuration PORT=8081 HOST=0.0.0.0 # Optional - JWT signing secret (set in production) SESSION_SECRET=your_secret_here ``` -------------------------------- ### Retrieve Application Metadata Source: https://context7.com/deepgram-starters/java-text-intelligence/llms.txt Fetch configuration details and project metadata from the service. ```bash # Get application metadata curl -s http://localhost:8081/api/metadata | jq # Response: { "title": "Java Text Intelligence Starter", "description": "Get started using Deepgram's Text Intelligence with this Java demo app", "author": "Deepgram DX Team (https://developers.deepgram.com)", "repository": "https://github.com/deepgram-starters/java-text-intelligence", "useCase": "text-intelligence", "language": "Java", "framework": "Javalin", "sdk": "N/A", "tags": ["text-intelligence", "text-analysis", "summarization", "topics", "sentiment", "java", "javalin"] } ``` -------------------------------- ### Maven Build and Execution Commands Source: https://context7.com/deepgram-starters/java-text-intelligence/llms.txt Use these commands to manage the application lifecycle during development. ```bash mvn compile exec:java -Dexec.mainClass=com.deepgram.starter.App ``` ```bash mvn package ``` ```bash java -jar target/java-text-intelligence-1.0.0-shaded.jar ``` ```bash mvn clean ``` -------------------------------- ### Docker Deployment Commands Source: https://context7.com/deepgram-starters/java-text-intelligence/llms.txt Commands for building the Docker image and running the container with required environment variables. ```bash docker build -f deploy/Dockerfile -t java-text-intelligence . docker run -p 8080:8080 \ -e DEEPGRAM_API_KEY=your_api_key \ -e SESSION_SECRET=your_production_secret \ java-text-intelligence ``` -------------------------------- ### Run Conformance Tests Source: https://github.com/deepgram-starters/java-text-intelligence/blob/main/AGENTS.md Execute conformance tests for the application. This requires the application to be running. ```bash make test ``` -------------------------------- ### Maven Build Commands Source: https://context7.com/deepgram-starters/java-text-intelligence/llms.txt Commands for managing Java project dependencies. ```bash # Install dependencies mvn dependency:resolve ``` -------------------------------- ### Analyze Text Content Source: https://context7.com/deepgram-starters/java-text-intelligence/llms.txt Submit text for analysis using the POST endpoint with JWT authentication. ```bash # First, obtain a session token TOKEN=$(curl -s http://localhost:8081/api/session | jq -r '.token') # Analyze text with all features enabled curl -X POST "http://localhost:8081/api/text-intelligence?summarize=true&topics=true&sentiment=true&intents=true" \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{ "text": "I absolutely love this new product! The quality is outstanding and the customer service team was incredibly helpful when I had questions. I would definitely recommend this to anyone looking for a reliable solution. The only minor issue was the shipping took a bit longer than expected, but overall I am very satisfied with my purchase." }' | jq ``` -------------------------------- ### Check Service Health Source: https://context7.com/deepgram-starters/java-text-intelligence/llms.txt Verify the operational status of the backend service. ```bash # Check service health curl -s http://localhost:8081/health | jq # Response: { "status": "ok", "service": "text-intelligence" } ``` -------------------------------- ### Manual Endpoint Checks with cURL Source: https://github.com/deepgram-starters/java-text-intelligence/blob/main/AGENTS.md Perform manual checks on the application's API endpoints using cURL and format the output with Python's JSON tool. ```bash curl -sf http://localhost:8081/api/metadata | python3 -m json.tool ``` ```bash curl -sf http://localhost:8081/api/session | python3 -m json.tool ``` -------------------------------- ### Analyze URL Content Source: https://context7.com/deepgram-starters/java-text-intelligence/llms.txt Perform text intelligence analysis on content retrieved from a specified URL. ```bash TOKEN=$(curl -s http://localhost:8081/api/session | jq -r '.token') # Analyze content from a URL curl -X POST "http://localhost:8081/api/text-intelligence?summarize=v2&topics=true" \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{ "url": "https://example.com/article.txt" }' | jq ``` -------------------------------- ### Selective Feature Analysis Source: https://context7.com/deepgram-starters/java-text-intelligence/llms.txt Enable specific intelligence features like summarization, sentiment, or topics using query parameters. ```bash TOKEN=$(curl -s http://localhost:8081/api/session | jq -r '.token') # Summarization only (use v2 or true) curl -X POST "http://localhost:8081/api/text-intelligence?summarize=v2" \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{"text": "Your long text content here..."}' | jq # Sentiment analysis only curl -X POST "http://localhost:8081/api/text-intelligence?sentiment=true" \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{"text": "I am extremely happy with the service!"}' | jq # Topics and intents combined curl -X POST "http://localhost:8081/api/text-intelligence?topics=true&intents=true" \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{"text": "I want to book a flight to Paris for my vacation next week."}' | jq # Specify language (default: en) curl -X POST "http://localhost:8081/api/text-intelligence?summarize=true&language=es" \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{"text": "Este es un texto en español para analizar."}' | jq ``` -------------------------------- ### Obtain JWT Session Token Source: https://context7.com/deepgram-starters/java-text-intelligence/llms.txt Request a signed JWT token required for accessing protected API endpoints. ```bash # Request a session token curl -s http://localhost:8081/api/session | jq # Response: { "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE3MDk4..." } # Store token for subsequent requests TOKEN=$(curl -s http://localhost:8081/api/session | jq -r '.token') echo "Token: $TOKEN" ``` -------------------------------- ### POST /api/text-intelligence - Analyze Text Content Source: https://context7.com/deepgram-starters/java-text-intelligence/llms.txt Analyzes text for summarization, topics, sentiment, and intents. Requires JWT authentication. Accepts either direct text or a URL in the request body. ```APIDOC ## POST /api/text-intelligence - Analyze Text Content ### Description Analyzes text for summarization, topics, sentiment, and intents. Requires JWT authentication. Accepts either direct text or a URL in the request body. ### Method POST ### Endpoint /api/text-intelligence ### Query Parameters - **summarize** (boolean) - Optional - Whether to perform summarization. - **topics** (boolean) - Optional - Whether to detect topics. - **sentiment** (boolean) - Optional - Whether to perform sentiment analysis. - **intents** (boolean) - Optional - Whether to recognize intents. ### Request Body - **text** (string) - Required - The text content to analyze. - **url** (string) - Required - The URL of the content to analyze. ### Request Example ```bash # First, obtain a session token TOKEN=$(curl -s http://localhost:8081/api/session | jq -r '.token') # Analyze text with all features enabled curl -X POST "http://localhost:8081/api/text-intelligence?summarize=true&topics=true&sentiment=true&intents=true" \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{ "text": "I absolutely love this new product! The quality is outstanding and the customer service team was incredibly helpful when I had questions. I would definitely recommend this to anyone looking for a reliable solution. The only minor issue was the shipping took a bit longer than expected, but overall I am very satisfied with my purchase." }' | jq ``` ### Response #### Success Response (200) - **summary** (string) - The summarized text (if requested). - **topics** (array of objects) - Detected topics with confidence scores (if requested). - **topic** (string) - The detected topic. - **confidence** (number) - The confidence score for the topic. - **sentiment** (array of objects) - Sentiment analysis results with per-segment breakdowns (if requested). - **sentiment** (string) - The sentiment (e.g., "positive", "negative", "neutral"). - **confidence** (number) - The confidence score for the sentiment. - **start** (number) - The start time of the segment. - **end** (number) - The end time of the segment. - **intents** (array of objects) - Identified user intents (if requested). - **intent** (string) - The identified intent. - **confidence** (number) - The confidence score for the intent. #### Response Example ```json { "summary": "The user is highly satisfied with a new product due to its outstanding quality and helpful customer service, despite a minor delay in shipping.", "topics": [ { "topic": "product quality", "confidence": 0.95 }, { "topic": "customer service", "confidence": 0.92 } ], "sentiment": [ { "sentiment": "positive", "confidence": 0.98, "start": 0.0, "end": 10.5 } ], "intents": [ { "intent": "purchase satisfaction", "confidence": 0.96 } ] } ``` ``` -------------------------------- ### POST /api/text-intelligence Source: https://github.com/deepgram-starters/java-text-intelligence/blob/main/AGENTS.md Analyzes provided text or URL content for summaries, topics, sentiment, and intents. ```APIDOC ## POST /api/text-intelligence ### Description Analyzes text for summaries, topics, sentiment, and intents. Requires a JWT session token. ### Method POST ### Endpoint /api/text-intelligence ### Parameters #### Query Parameters - **summarize** (boolean/string) - Optional - Enable summary generation (values: true, v2) - **topics** (boolean) - Optional - Enable topic detection - **sentiment** (boolean) - Optional - Enable sentiment analysis - **intents** (boolean) - Optional - Enable intent detection - **language** (string) - Optional - Language code (default: en) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.