Spaces:
Runtime error
Runtime error
Added option to include a diagram of the architecture under test on the architectures page.
Browse files- config/architectures.json +2 -1
- pages/010_LLM_Architectures.py +3 -0
- src/architectures.py +8 -2
- src/common.py +1 -0
config/architectures.json
CHANGED
@@ -17,7 +17,8 @@
|
|
17 |
{"class": "RetrievalAugmentor", "params": {"vector_store": "products_tvs"}},
|
18 |
{"class": "HFLlamaHttpRequestor", "params": {"model": "meta-llama/Llama-2-7b-chat-hf", "system_prompt": "You are a helpful domestic appliance advisor. Please answer the following customer question, answering only from the facts provided. Do not make things up, and say if you cannot answer.", "max_tokens": 2000}},
|
19 |
{"class": "OutputResponseScreener"}
|
20 |
-
]
|
|
|
21 |
}
|
22 |
]
|
23 |
}
|
|
|
17 |
{"class": "RetrievalAugmentor", "params": {"vector_store": "products_tvs"}},
|
18 |
{"class": "HFLlamaHttpRequestor", "params": {"model": "meta-llama/Llama-2-7b-chat-hf", "system_prompt": "You are a helpful domestic appliance advisor. Please answer the following customer question, answering only from the facts provided. Do not make things up, and say if you cannot answer.", "max_tokens": 2000}},
|
19 |
{"class": "OutputResponseScreener"}
|
20 |
+
],
|
21 |
+
"img": "architecture_rag.jpg"
|
22 |
}
|
23 |
]
|
24 |
}
|
pages/010_LLM_Architectures.py
CHANGED
@@ -2,6 +2,7 @@ import pandas as pd
|
|
2 |
import streamlit as st
|
3 |
|
4 |
from src.st_helpers import st_setup
|
|
|
5 |
from src.architectures import *
|
6 |
|
7 |
|
@@ -22,6 +23,8 @@ def show_architecture(architecture: str) -> None:
|
|
22 |
st.write(f'### {arch.name}')
|
23 |
st.write('#### Architecture description')
|
24 |
st.write(arch.description)
|
|
|
|
|
25 |
table_data = []
|
26 |
for j, s in enumerate(arch.steps, start=1):
|
27 |
table_data.append(
|
|
|
2 |
import streamlit as st
|
3 |
|
4 |
from src.st_helpers import st_setup
|
5 |
+
from src.common import img_dir
|
6 |
from src.architectures import *
|
7 |
|
8 |
|
|
|
23 |
st.write(f'### {arch.name}')
|
24 |
st.write('#### Architecture description')
|
25 |
st.write(arch.description)
|
26 |
+
if arch.img is not None:
|
27 |
+
st.image(os.path.join(img_dir, arch.img), caption=f'Protypical {arch.name} Under Test', width=1000)
|
28 |
table_data = []
|
29 |
for j, s in enumerate(arch.steps, start=1):
|
30 |
table_data.append(
|
src/architectures.py
CHANGED
@@ -11,7 +11,7 @@ import traceback
|
|
11 |
from abc import ABC, abstractmethod
|
12 |
from enum import Enum
|
13 |
from time import time
|
14 |
-
from typing import List
|
15 |
from better_profanity import profanity
|
16 |
|
17 |
from src.common import config_dir, data_dir, hf_api_token
|
@@ -192,6 +192,9 @@ class Architecture:
|
|
192 |
for c in configs:
|
193 |
arch_name = c['name']
|
194 |
arch_description = c['description']
|
|
|
|
|
|
|
195 |
arch_comps = []
|
196 |
for s in c['steps']:
|
197 |
component_class_name = s['class']
|
@@ -199,7 +202,8 @@ class Architecture:
|
|
199 |
if 'params' in s:
|
200 |
component_init_params = s['params']
|
201 |
arch_comps.append(globals()[component_class_name](**component_init_params))
|
202 |
-
|
|
|
203 |
cls.architectures = archs
|
204 |
|
205 |
@classmethod
|
@@ -220,11 +224,13 @@ class Architecture:
|
|
220 |
name: str,
|
221 |
description: str,
|
222 |
steps: List[ArchitectureComponent],
|
|
|
223 |
exception_text: str = "Sorry an internal technical error occurred.",
|
224 |
no_response_text: str = "Sorry I can't answer that."):
|
225 |
self.name = name
|
226 |
self.description = description
|
227 |
self.steps = steps
|
|
|
228 |
self.exception_text = exception_text
|
229 |
self.no_response_text = no_response_text
|
230 |
|
|
|
11 |
from abc import ABC, abstractmethod
|
12 |
from enum import Enum
|
13 |
from time import time
|
14 |
+
from typing import List, Optional
|
15 |
from better_profanity import profanity
|
16 |
|
17 |
from src.common import config_dir, data_dir, hf_api_token
|
|
|
192 |
for c in configs:
|
193 |
arch_name = c['name']
|
194 |
arch_description = c['description']
|
195 |
+
arch_img = None
|
196 |
+
if 'img' in c:
|
197 |
+
arch_img = c['img']
|
198 |
arch_comps = []
|
199 |
for s in c['steps']:
|
200 |
component_class_name = s['class']
|
|
|
202 |
if 'params' in s:
|
203 |
component_init_params = s['params']
|
204 |
arch_comps.append(globals()[component_class_name](**component_init_params))
|
205 |
+
arch = Architecture(name=arch_name, description=arch_description, steps=arch_comps, img=arch_img)
|
206 |
+
archs.append(arch)
|
207 |
cls.architectures = archs
|
208 |
|
209 |
@classmethod
|
|
|
224 |
name: str,
|
225 |
description: str,
|
226 |
steps: List[ArchitectureComponent],
|
227 |
+
img: Optional[str] = None,
|
228 |
exception_text: str = "Sorry an internal technical error occurred.",
|
229 |
no_response_text: str = "Sorry I can't answer that."):
|
230 |
self.name = name
|
231 |
self.description = description
|
232 |
self.steps = steps
|
233 |
+
self.img = img
|
234 |
self.exception_text = exception_text
|
235 |
self.no_response_text = no_response_text
|
236 |
|
src/common.py
CHANGED
@@ -3,6 +3,7 @@ import streamlit as st
|
|
3 |
|
4 |
|
5 |
data_dir = os.path.join(os.path.dirname(__file__), '..', 'data')
|
|
|
6 |
config_dir = os.path.join(os.path.dirname(__file__), '..', 'config')
|
7 |
|
8 |
def hf_api_token() -> str:
|
|
|
3 |
|
4 |
|
5 |
data_dir = os.path.join(os.path.dirname(__file__), '..', 'data')
|
6 |
+
img_dir = os.path.join(os.path.dirname(__file__), '..', 'img')
|
7 |
config_dir = os.path.join(os.path.dirname(__file__), '..', 'config')
|
8 |
|
9 |
def hf_api_token() -> str:
|