Skip to content

Commit

Permalink
feat: add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Angular2Guy committed Jul 12, 2024
1 parent e183385 commit 3c30742
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public CodeGenerationController(CodeGenerationService codeGenerationService) {
this.codeGenerationService = codeGenerationService;
}

// http://localhost:8080/rest/code-generation/test?url=https://github.com/Angular2Guy/MovieManager/blob/master/backend/src/main/java/ch/xxx/moviemanager/adapter/controller/ActorController.java&testUrl=https://github.com/Angular2Guy/MovieManager/blob/master/backend/src/test/java/ch/xxx/moviemanager/adapter/controller/MovieControllerTest.java
// http://localhost:8080/rest/code-generation/test?url=https://github.com/Angular2Guy/MovieManager/blob/master/backend/src/main/java/ch/xxx/moviemanager/usecase/service/ActorService.java&testUrl=https://github.com/Angular2Guy/MovieManager/blob/master/backend/src/test/java/ch/xxx/moviemanager/usecase/service/MovieServiceTest.java
@GetMapping("/test")
public String getGenerateTests(@RequestParam("url") String url,
@RequestParam(name = "testUrl", required = false) String testUrl) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ public String generateTest(String url, Optional<String> testUrlOpt) {
Map.of("classToTest", classToTest, "contextClasses", contextClasses, "testExample", testExample)).createMessage().getContent());
var response = chatClient.call(new PromptTemplate(this.ollamaPrompt,
Map.of("classToTest", classToTest, "contextClasses", contextClasses, "testExample", testExample)).create());
LOGGER.info("Prompt tokens: " + response.getMetadata().getUsage().getPromptTokens());
LOGGER.info("Generation tokens: " + response.getMetadata().getUsage().getGenerationTokens());
LOGGER.info("Total tokens: " + response.getMetadata().getUsage().getTotalTokens());
return response.getResult().getOutput().getContent();
}

Expand Down

0 comments on commit 3c30742

Please sign in to comment.