mirror of
https://github.com/wassname/stampy-chat.git
synced 2026-09-11 12:50:34 +08:00
basic submodule working
This commit is contained in:
+6
-2
@@ -27,6 +27,10 @@ ENCODER = tiktoken.get_encoding("cl100k_base")
|
||||
|
||||
DEBUG_PRINT = True
|
||||
|
||||
def set_debug_print(val: bool):
|
||||
global DEBUG_PRINT
|
||||
DEBUG_PRINT = val
|
||||
|
||||
# --------------------------------- prompt code --------------------------------
|
||||
|
||||
|
||||
@@ -187,10 +191,10 @@ def talk_to_robot(index, query: str, history: List[Dict[str, str]], k: int = STA
|
||||
yield from (json.dumps(block) for block in talk_to_robot_internal(index, query, history, k, log))
|
||||
|
||||
# wayyy simplified api
|
||||
def talk_to_robot_simple(index, query: str):
|
||||
def talk_to_robot_simple(index, query: str, log: Callable = print):
|
||||
res = {'response': ''}
|
||||
|
||||
for block in talk_to_robot_internal(index, query, []):
|
||||
for block in talk_to_robot_internal(index, query, [], log = log):
|
||||
if block['state'] == 'loading' and block['phase'] == 'semantic' and 'citations' in block:
|
||||
citations = {}
|
||||
for i, c in enumerate(block['citations']):
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
import sys
|
||||
from pathlib import Path
|
||||
sys.path = [str(Path(__file__).parent.parent)] + sys.path
|
||||
from env import PINECONE_INDEX
|
||||
|
||||
from chat import talk_to_robot_simple, set_debug_print
|
||||
|
||||
set_debug_print(False)
|
||||
print(talk_to_robot_simple(PINECONE_INDEX, 'Hello.', log = lambda x: None))
|
||||
@@ -0,0 +1,3 @@
|
||||
```bash
|
||||
pipenv run python3 prompteng/prompteng.py
|
||||
```
|
||||
Reference in New Issue
Block a user