-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from gomate-community/init_framework
initialize framework and rewriter module
- Loading branch information
Showing
6 changed files
with
42 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,19 @@ | ||
# GoMate | ||
# GoMate | ||
|
||
RAG Framework with configurable modules. | ||
|
||
[![python](https://img.shields.io/badge/Python-3.8.18-3776AB.svg?style=flat&logo=python&logoColor=white)](https://www.python.org) | ||
![workflow status](https://github.com/gomate-community/rageval/actions/workflows/makefile.yml/badge.svg) | ||
[![pydocstyle](https://img.shields.io/badge/pydocstyle-enabled-AD4CD3)](http://www.pydocstyle.org/en/stable/) | ||
[![PEP8](https://img.shields.io/badge/code%20style-pep8-orange.svg)](https://www.python.org/dev/peps/pep-0008/) | ||
|
||
## Installation | ||
|
||
``` | ||
git clone https://github.com/gomate-community/GoMate.git | ||
``` | ||
## Usage | ||
|
||
``` | ||
git install ... | ||
``` |
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,10 +1,14 @@ | ||
|
||
|
||
class HyDE_rewriter(): | ||
"""This is HyDE rewriter.""" | ||
|
||
def __init__(self): | ||
"""Init the hyde rewriter model""" | ||
pass | ||
|
||
def run(query, temperature): | ||
def run(self, query, temperature): | ||
"""Get rewrited querys in runtime""" | ||
# TODO | ||
answer = [['改写后的回答']] | ||
return(answer) | ||
return answer |
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 +1 @@ | ||
from HyDE_rewriter import HyDE_rewriter | ||
from .HyDE_rewriter import HyDE_rewriter |
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,19 +1,24 @@ | ||
from .components import HyDE_rewriter | ||
|
||
rewriter_list = ['hyde'] | ||
|
||
class Rewriter(): | ||
''' | ||
改写模块,用于理解和优化用户的原始问题。实现包括: | ||
"""改写模块,用于理解和优化用户的原始问题。 | ||
实现包括 | ||
1. HyDE。用生成式大模型预回答,返回生成的假定答案。 | ||
2. ... | ||
''' | ||
""" | ||
|
||
def __init__(self, component_name=None): | ||
assert component_name in rewriter_list | ||
"""Init required rewriter according to component name.""" | ||
self.rewriter_list = ['hyde'] | ||
assert component_name in self.rewriter_list | ||
if component_name == 'hyde': | ||
self.rewriter = HyDE_rewriter() | ||
|
||
def run(self, query, temperature=1e-10): | ||
"""Run the required rewriter""" | ||
if query is None: | ||
raise ValueError('原始问题不能为空') | ||
return(self.rewriter.run(query, temperature = temperature)) | ||
return self.rewriter.run(query, temperature) |
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,12 +1,9 @@ | ||
"""Test building RAG system.""" | ||
|
||
import sys | ||
sys.path.insert(0, '../src') | ||
import pytest | ||
|
||
@pytest.mark.cron | ||
@pytest.mark.skip | ||
def test_build(): | ||
''' | ||
xx | ||
''' | ||
pass | ||
return |
3 changes: 2 additions & 1 deletion
3
tests/units/query_rewriter.py → tests/units/test_query_rewriter.py
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