-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DEPLOY : BE - Similar Step 찾는 API 생성 (#49)
* be-feat/serverSetUp (#14) * [BE] JIRA-73 #comment springboot server initialize * [BE] JIRA-73 #test #comment springboot server initialize test * JIRA-73 #BUG_FIX #comment IDEA gitignore 추가 * JIRA-97 #DOCS #comment 'PR workflow reviewer 반영안되는 오류 수정' * JIRA-97 #DOCS #comment 'PR workflow reviewer 반영안되는 오류 수정' * JIRA-97 #DOCS #comment 'PR workflow reviewer api 요청 결과에 맞게 fail하도록 변경' * JIRA-97 #DOCS #comment 'PR workflow token 설정' --------- Co-authored-by: tank3a <[email protected]> * JIRA-42 #feat #comment "CodeDeploy 실행을 위한 Script 파일 추가" * JIRA-42 #bug_fix #comment "CodeDeploy 실행 스크립트 디렉토리 위치 오류 해결" * Revert "JIRA-42 #bug_fix #comment "CodeDeploy 실행 스크립트 디렉토리 위치 오류 해결"" This reverts commit e522d54. * Revert "JIRA-42 #feat #comment "CodeDeploy 실행을 위한 Script 파일 추가"" This reverts commit 289da5c. * JIRA-42 #feat #comment "CodeDeploy 실행을 위한 Script 파일 추가" * JIRA-42 #bug_fix #comment "CodeDeploy 실행 스크립트 디렉토리 위치 오류 해결" * JIRA-42 #bug_fix #comment "start_server.sh 파일 위치 오류 해결" * JIRA-42 #bug_fix #comment "stop_server.sh 파일 위치 오류 해결" * JIRA-93 #feat #comment "Llama로부터 API 요청 및 응답 처리" * JIRA-60 #feat #comment "Client로부터 Task 요청 받는 API 프레임 생성" * JIRA-123 #feat #comment "MongoDB 연결 위한 Repository 및 Entity, properties 설정. build.gradle 추가" * JIRA-93 #feat #comment "Llama 응답 timeout 설정" * JIRA-93 #feat #comment "Llama subTask 요청 구현" * JIRA-38 #feat #comment "Client Stream 처리 구현" * JIRA-60 #feat #comment "Task 요청 API 구현" * JIRA-60 #close #comment "불필요한 부분 제거" * JIRA-93 #close #comment "직관적이지 않은 이름 수정" * JIRA-93 #close #comment "수정시 빠진 부분 재수정" * JIRA-93 #close #comment "수정시 빠진 부분 재수정" * Delete application.properties * JIRA-91 #feat #comment "클라이언트의 code를 저장하는 api 구성 완료" * JIRA-37 #feat #comment "전체 http메소드 cors설정 완료" * JIRA-91 #refac #comment "오타수정 및 리팩토링" * JIRA-133 #refac #comment "Task 요청 API Get으로 메서드 변경" * JIRA-112 #refac #comment "matcherParse 오탈자 수정" * JIRA-134 #chore #comment "불필요한 dependency 삭제" * JIRA-134 #feat #comment "Step을 Embedding Vector로 바꾸기 위한 DTO 추가 및 float[] 추가" * JIRA-134 #feat #comment "Similarity 계산 위한 Service Class 생성" * JIRA-134 #refac #comment "새로운 Llama API 추가로 인한 기존 코드의 명칭 개선" * JIRA-134 #feat #comment "Llama Server에서 Sent2vec Response 받는 로직 완성" * JIRA-135 #feat #comment "Reactive 처리 위한 Llama Server API Response를 Mono로 받음" * JIRA-135 #feat #comment "Task 요청 관련 추적용 Log 생성" * JIRA-134 #feat #comment "받아온 Vector값으로 Top Rank의 Step 반환" * JIRA-135 #chore #comment "불필요한 gradle build 파일 업로드 제거" * JIRA-135 #refac #comment "TASK 요청 시 [DONE] 키워드가 오면 버퍼 모두 내보내도록 처리 로직 수정" * JIRA-135 #refac #comment "vector value 크기가 64bit이므로 float->double 변경" * JIRA-135 #bugfix #comment "flux내에서 다른 api 호출 시 조기 종료되는 버그 발생으로 api 분리" * JIRA-136 #bugfix #comment "gradle ignore 취소" * JIRA-136 #bugfix #comment "gradle ignore 취소" --------- Co-authored-by: humang <[email protected]>
- Loading branch information
Showing
20 changed files
with
368 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 5 additions & 2 deletions
7
backend/epimetheus/src/main/java/uos/capstone/epimetheus/adapter/LlamaAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
package uos.capstone.epimetheus.adapter; | ||
|
||
import reactor.core.publisher.Flux; | ||
import uos.capstone.epimetheus.dtos.LlamaResponse; | ||
import reactor.core.publisher.Mono; | ||
import uos.capstone.epimetheus.dtos.LlamaStepResponse; | ||
|
||
public interface LlamaAdapter { | ||
Flux<LlamaResponse> fetchDataAsStream(String json); | ||
Flux<LlamaStepResponse> getAllTaskSteps(String json); | ||
|
||
Mono<double[]> getVectorFromSentence(String sentence); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 0 additions & 29 deletions
29
backend/epimetheus/src/main/java/uos/capstone/epimetheus/dtos/LlamaResponse.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
backend/epimetheus/src/main/java/uos/capstone/epimetheus/dtos/LlamaStepResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package uos.capstone.epimetheus.dtos; | ||
|
||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Getter | ||
public class LlamaStepResponse { | ||
private List<Choice> choices; | ||
|
||
public String parseContent() { | ||
try { | ||
return choices.get(0).getDelta().getContent(); | ||
} catch (NullPointerException e) { | ||
return ""; | ||
} | ||
} | ||
|
||
public static LlamaStepResponse eof() { | ||
LlamaStepResponse response = new LlamaStepResponse(); | ||
response.choices = new ArrayList<>(); | ||
response.choices.add(new Choice("[DONE]")); | ||
|
||
return response; | ||
} | ||
} | ||
@Getter | ||
@NoArgsConstructor | ||
class Choice { | ||
private Delta delta; | ||
|
||
Choice(String content) { | ||
this.delta = new Delta(content); | ||
} | ||
|
||
} | ||
@Getter | ||
@NoArgsConstructor | ||
class Delta { | ||
private String content = ""; | ||
|
||
Delta(String content) { | ||
this.content = content; | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
backend/epimetheus/src/main/java/uos/capstone/epimetheus/dtos/LlamaVectorRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package uos.capstone.epimetheus.dtos; | ||
|
||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
public class LlamaVectorRequest { | ||
|
||
private String input; | ||
|
||
@Builder | ||
public LlamaVectorRequest(String input) { | ||
this.input = input; | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
backend/epimetheus/src/main/java/uos/capstone/epimetheus/dtos/LlamaVectorResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package uos.capstone.epimetheus.dtos; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import lombok.Getter; | ||
|
||
import java.util.List; | ||
|
||
@Getter | ||
public class LlamaVectorResponse { | ||
|
||
private List<EmbeddingData> data; | ||
private TokenUsage usage; | ||
|
||
public double[] getVector() { | ||
if((data != null ? data.size() : 0) != 1) { | ||
throw new RuntimeException("Invalid Data Came"); | ||
} | ||
|
||
return data.get(0).getEmbedding(); | ||
} | ||
} | ||
|
||
@Getter | ||
class EmbeddingData { | ||
|
||
private String object; | ||
private double[] embedding; | ||
private int index; | ||
} | ||
|
||
@Getter | ||
class TokenUsage { | ||
private int prompt_tokens; | ||
private int total_tokens; | ||
} |
Oops, something went wrong.