|
55 | 55 | ) |
56 | 56 | from modules.llm_assistant.prompts.annotation_prompt_builder import ( |
57 | 57 | AnnotationPromptBuilder, |
58 | | - OllamaAnnotationResults, |
| 58 | + LLMAnnotationResults, |
59 | 59 | ) |
60 | 60 | from modules.llm_assistant.prompts.metadata_prompt_builder import ( |
| 61 | + LLMMetadataExtractionResults, |
61 | 62 | MetadataPromptBuilder, |
62 | | - OllamaMetadataExtractionResults, |
63 | 63 | ) |
64 | 64 | from modules.llm_assistant.prompts.prompt_builder import PromptBuilder |
65 | 65 | from modules.llm_assistant.prompts.sentence_annotation_prompt_builder import ( |
66 | | - OllamaSentenceAnnotationResults, |
| 66 | + LLMSentenceAnnotationResults, |
67 | 67 | SentenceAnnotationPromptBuilder, |
68 | 68 | ) |
69 | 69 | from modules.llm_assistant.prompts.tagging_prompt_builder import ( |
70 | | - OllamaTaggingResult, |
| 70 | + LLMTaggingResult, |
71 | 71 | TaggingPromptBuilder, |
72 | 72 | ) |
73 | 73 | from ray_model_worker.dto.seqsenttagger import SeqSentTaggerDoc, SeqSentTaggerJobInput |
74 | 74 | from repos.db.sql_repo import SQLRepo |
75 | | -from repos.ollama_repo import OllamaRepo |
| 75 | +from repos.llm_repo import LLMRepo |
76 | 76 | from repos.ray_repo import RayRepo |
77 | 77 | from repos.vector.weaviate_repo import WeaviateRepo |
78 | 78 | from systems.job_system.job_dto import Job |
|
83 | 83 | class LLMAssistantService(metaclass=SingletonMeta): |
84 | 84 | def __new__(cls, *args, **kwargs): |
85 | 85 | cls.sqlr: SQLRepo = SQLRepo() |
86 | | - cls.ollama: OllamaRepo = OllamaRepo() |
| 86 | + cls.llm: LLMRepo = LLMRepo() |
87 | 87 | cls.ray: RayRepo = RayRepo() |
88 | 88 | cls.weaviate: WeaviateRepo = WeaviateRepo() |
89 | 89 |
|
@@ -439,10 +439,10 @@ def _llm_tagging( |
439 | 439 | ) |
440 | 440 |
|
441 | 441 | # prompt the model |
442 | | - response = self.ollama.llm_chat( |
| 442 | + response = self.llm.llm_chat( |
443 | 443 | system_prompt=system_prompt, |
444 | 444 | user_prompt=user_prompt, |
445 | | - response_model=OllamaTaggingResult, |
| 445 | + response_model=LLMTaggingResult, |
446 | 446 | ) |
447 | 447 | logger.info( |
448 | 448 | f"Got chat response! Tags={response.categories}, Reason={response.reasoning}" |
@@ -570,10 +570,10 @@ def _llm_metadata_extraction( |
570 | 570 | ) |
571 | 571 |
|
572 | 572 | # prompt the model |
573 | | - response = self.ollama.llm_chat( |
| 573 | + response = self.llm.llm_chat( |
574 | 574 | system_prompt=system_prompt, |
575 | 575 | user_prompt=user_prompt, |
576 | | - response_model=OllamaMetadataExtractionResults, |
| 576 | + response_model=LLMMetadataExtractionResults, |
577 | 577 | ) |
578 | 578 | logger.info(f"Got chat response! Response={response.data}") |
579 | 579 |
|
@@ -705,10 +705,10 @@ def _llm_annotation( |
705 | 705 | ) |
706 | 706 |
|
707 | 707 | # prompt the model |
708 | | - response = self.ollama.llm_chat( |
| 708 | + response = self.llm.llm_chat( |
709 | 709 | system_prompt=system_prompt, |
710 | 710 | user_prompt=user_prompt, |
711 | | - response_model=OllamaAnnotationResults, |
| 711 | + response_model=LLMAnnotationResults, |
712 | 712 | ) |
713 | 713 | logger.info(f"Got chat response! Response={response}") |
714 | 714 |
|
@@ -814,7 +814,7 @@ def _llm_sentence_annotation( |
814 | 814 | ), "Wrong approach parameters!" |
815 | 815 | is_fewshot = isinstance(approach_parameters, FewShotParams) |
816 | 816 |
|
817 | | - msg = f"Started LLMJob - Sentence Annotation (OLLAMA), num docs: {len(task_parameters.sdoc_ids)}" |
| 817 | + msg = f"Started LLMJob - Sentence Annotation (LLM), num docs: {len(task_parameters.sdoc_ids)}" |
818 | 818 | self._update_llm_job_description( |
819 | 819 | job=job, |
820 | 820 | description=msg, |
@@ -901,10 +901,10 @@ def _llm_sentence_annotation( |
901 | 901 | ) |
902 | 902 |
|
903 | 903 | # prompt the model |
904 | | - response = self.ollama.llm_chat( |
| 904 | + response = self.llm.llm_chat( |
905 | 905 | system_prompt=system_prompt, |
906 | 906 | user_prompt=user_prompt, |
907 | | - response_model=OllamaSentenceAnnotationResults, |
| 907 | + response_model=LLMSentenceAnnotationResults, |
908 | 908 | ) |
909 | 909 | logger.info(f"Got chat response! Response={response}") |
910 | 910 |
|
|
0 commit comments