Update chatbot_bedrock.py
Browse files- chatbot_bedrock.py +7 -0
chatbot_bedrock.py
CHANGED
|
@@ -22,6 +22,13 @@ class HuggingFaceModelWrapper(Runnable): # Assuming Runnable is the required in
|
|
| 22 |
# Decode the generated tokens to a string
|
| 23 |
response_text = self.tokenizer.decode(output[0], skip_special_tokens=True)
|
| 24 |
return response_text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
|
| 27 |
@st.cache_resource
|
|
|
|
| 22 |
# Decode the generated tokens to a string
|
| 23 |
response_text = self.tokenizer.decode(output[0], skip_special_tokens=True)
|
| 24 |
return response_text
|
| 25 |
+
def invoke(self, *args, **kwargs):
|
| 26 |
+
# Implement the 'invoke' method as required by the abstract base class/interface
|
| 27 |
+
# The implementation here depends on what 'invoke' is supposed to do. As an example:
|
| 28 |
+
|
| 29 |
+
# Assuming 'invoke' should process some input and return a model response
|
| 30 |
+
input_text = args[0] if args else kwargs.get('input_text', '')
|
| 31 |
+
return self.run(input_text)
|
| 32 |
|
| 33 |
|
| 34 |
@st.cache_resource
|