Commit Graph

94 Commits

Author SHA1 Message Date
sku b77a3c2e3d Correct informal language handling in tests 2024-09-20 11:03:12 +02:00
sku 81ca3762ea Add new test cases for RoutingParametersServiceIntegrationTest 2024-09-20 10:27:46 +02:00
Jim Martens b876cb8461
Added missing atZone again 2024-09-19 23:57:05 +02:00
Jim Martens 4fb4c7b5d4
Fix time-zone issue for relative requests 2024-09-19 23:29:30 +02:00
sku af30db6330 Disable RoutingParametersServiceIntegrationTest again 2024-09-19 16:11:17 +02:00
sku 479fc8e84d Refactor routing parameters test; simplify system prompt to recognize the current time by default
Refactored the integration test to use parameterized tests for better readability and maintainability.
2024-09-19 16:07:25 +02:00
Jim Martens d0f6bb58b9
feat: Add support for coordinates as start/dest 2024-09-19 14:07:18 +02:00
ljhbt 879d56acfa Add test for routing parameters with current time
Introduced a new integration test to verify the routing parameters service when provided with the current time. This ensures the service correctly handles real-time prompts and checks it against a near-current timestamp, allowing a margin of fewer than 10 seconds.
2024-09-19 13:36:50 +02:00
Jim Martens c38079744a
Removed reference to GtiException 2024-09-19 13:29:49 +02:00
Jim Martens 13659ae600
Properly handle Gti exceptions 2024-09-19 13:26:16 +02:00
sku 850019c0d8 Add integration test for RoutingParametersService
This commit introduces a new manual integration test for the `RoutingParametersService`The test checks both the retrieval of routing parameters and the state of the conversation cache.
2024-09-19 11:32:25 +02:00
ljhbt e3db3b09c8 Refactor system prompt generation into a separate method
Refactored the generation of system prompts into dedicated methods across `RoutingParametersService` and `GTIOrchestrationService`. This improves code readability, maintainability, and ensures consistent prompt format.
2024-09-19 11:07:42 +02:00
sku 0cdb7cecd9 Refactor date/time formatting and improve API request handling.
This commit introduces proper localized date and time formatting for GTI requests by adding dedicated formatters with a specific time zone. Additionally, it refines API documentation annotations, streamlines method formatting, and enhances error handling to improve code readability and maintain consistency.
2024-09-19 09:03:50 +02:00
Jim Martens 1ac4c8af52
Fix package for datatype 2024-09-19 08:57:58 +02:00
Jim Martens 85e377108d
Move dependency to version catalog 2024-09-19 08:46:45 +02:00
sku a7b03f1373 Update ChatRequest default model to the cheaper 'gpt-4o-mini' 2024-09-19 08:43:57 +02:00
Jim Martens a69761360b
Always print display language in English 2024-09-18 19:25:25 +02:00
Jim Martens e01a3d2095
Provide answer in user language 2024-09-18 19:23:23 +02:00
sku a25d27cc5d Update GTIOrchestrationService system prompt
Revised the system prompt to provide routing advice in German. Now the assistant gives concise advice including transport mode, changes, and arrival times. This enhances user guidance and clarity.
2024-09-18 17:47:12 +02:00
sku e1908f8ab3 Switch to Jackson for JSON operations
Replaced Gson with Jackson's ObjectMapper for JSON serialization and deserialization in GTIOrchestrationService. Added JavaTimeModule registration for proper handling of Java time classes. Updated dependencies in server.gradle.kts to include jackson-datatype-jsr310.
2024-09-18 16:47:41 +02:00
ljhbt 7753d78d81 Refactor GTIOrchestrationService to add gpt method.
This change introduces a new method, gpt, which is responsible for handling the GPT processing logic. The main function has been updated to use this new method for cleaner and more modular code.
2024-09-18 16:07:35 +02:00
ljhbt 7a707da748 Refactor time handling to use OffsetDateTime
Replaced String with OffsetDateTime for time-related fields in GTIOrchestrationService and AppController. This change improves the handling of dates and times by leveraging the capabilities of the OffsetDateTime class, ensuring better accuracy and consistency.
2024-09-18 15:21:21 +02:00
sku 87b2d6f106 Update time handling logic in RoutingParametersService
Extend the interpretation of user-provided times to handle current time requests more accurately. The service now explicitly checks for terms like 'now' and 'today', defaulting to the current time on specified days if no precise time is provided. This ensures more intuitive handling of various time-related inputs.
2024-09-18 14:59:49 +02:00
sku 9248f5a9a9 Refactor time handling in RoutingParametersService
Updated timezone handling to "Europe/Berlin" and refactored date-time formatting to use `DateTimeFormatter.ISO_OFFSET_DATE_TIME`. Introduced constants to manage current and test times.
2024-09-18 14:51:17 +02:00
Jim Martens f04ded48a0
Fixed exception handling 2024-09-18 14:21:03 +02:00
Jim Martens 8743b904c6
Simplified type hierarchy 2024-09-18 14:11:22 +02:00
sku 3f87add6e0 Update routing prompt for UTC timestamps and current date/time.
Changed `SYSTEM_PROMPT` to a dynamic value that includes the current date and time in UTC format. This enhances the precision and relevance of the extracted routing information by ensuring timestamps are always up to date.
2024-09-18 14:02:03 +02:00
Jim Martens cf1770182c
Add security requirement annotation (no actual security) 2024-09-18 14:00:14 +02:00
Jim Martens 8ac3c435d4
Improve exception handling 2024-09-18 13:56:51 +02:00
Jim Martens 4c2a9624d8
Use status provided in Exception 2024-09-18 13:54:15 +02:00
Jim Martens 45bc146b50
Fix merge conflicts 2024-09-18 13:52:38 +02:00
Jim Martens 75b853eb11
change: Adjust endpoints to make more semantic sense 2024-09-18 13:47:16 +02:00
sku 8a906024b1 Refactor ChatService to RoutingParametersService
Renamed ChatService to RoutingParametersService for clarity and adjusted functions accordingly. Removed the ChatService interface and now directly handle routing parameters within the renamed service. Updated the AppController to reflect these changes, ensuring seamless integration.
2024-09-18 13:43:11 +02:00
sku a4484dd0e2 Refactor OpenAI chat integration and optimize service calls.
This commit streamlines the chat service by integrating OpenAIService directly into GTIOrchestrationService and ChatServiceImpl, eliminating redundant methods. It standardizes requests and responses using the `chatRequest` method, improves error handling, and relocates ConversationCache for better modularity.
2024-09-18 13:30:59 +02:00
ljhbt f599581bcc Add GTIOrchestrationService and integrate Gson
Implemented a new service, GTIOrchestrationService, to handle orchestration logic. Added Gson dependency for JSON processing and integrated it into the chat method to convert GTI responses to JSON. This enhances the functionality by allowing JSON responses to be handled more effectively.
2024-09-18 13:15:35 +02:00
sku 88f49b0032 Add role parameter to ChatRequest constructor
Refactor ChatRequest to include the 'role' parameter in the constructor, enhancing the flexibility of message roles. Updated OpenAIService to use the new constructor and added a system prompt message to guide user interactions.
2024-09-18 11:11:34 +02:00
sku 5a367a339c Refactor OpenAI integration and enhance ChatService
Removed the old OpenAIService and integrated a new version with additional DTOs and a RestTemplate configuration. The `ChatServiceImpl` now makes use of the OpenAI API for generating responses. Jackson Kotlin module support added for JSON deserialization.
2024-09-18 09:15:02 +02:00
Jim Martens 74dd3a5f85
change: Allow /v1/chat/* without authentication 2024-09-18 09:13:37 +02:00
Jim Martens bd095209d5
change: Unified structure and added versioning prefix 2024-09-18 08:51:38 +02:00
Jim Martens 977e7d7008
change: Pass-in Open AI API secret via environment variables 2024-09-18 08:46:04 +02:00
Jim Martens 217407f372
ci: Pass-through correct token to deploy workflow 2024-09-17 20:43:39 +02:00
Jim Martens 8ea7207af3
ci: Use correct token 2024-09-17 20:31:57 +02:00
Jim Martens e961bafa4f
ci: Correct passed secret 2024-09-17 20:29:01 +02:00
Jim Martens 2f5f97703d
ci: Use GITHUB_TOKEN 2024-09-17 20:26:40 +02:00
Jim Martens 856b8162f7
ci: Fix name of passed secret 2024-09-17 20:26:07 +02:00
Jim Martens a9a48ef2b0
ci: Add missing token input 2024-09-17 20:25:17 +02:00
Jim Martens 5377f7f486
ci: Add missing token 2024-09-17 19:09:25 +02:00
Jim Martens 74d880b5e0
ci: Add missing permission for docker-image workflow 2024-09-17 19:02:32 +02:00
Jim Martens b0ee0b52d2
ci: Automatically deploy after building docker image 2024-09-17 19:01:09 +02:00
Jim Martens 99136e5401
feat: Add GTIService to call GTI 2024-09-17 17:38:41 +02:00