Skip to content

🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming

Added streaming support for Jamba-Instruct

JGalego58a5720f014b
diff --git a/metagpt/provider/bedrock/bedrock_provider.py b/metagpt/provider/bedrock/bedrock_provider.py
index 6a7c91740..3222d2c76 100644
--- a/metagpt/provider/bedrock/bedrock_provider.py
+++ b/metagpt/provider/bedrock/bedrock_provider.py
@@ -114,6 +114,11 @@ class Ai21Provider(BaseBedrockProvider):
)
return body
+ def get_choice_text_from_stream(self, event) -> str:
+ rsp_dict = json.loads(event["chunk"]["bytes"])
+ completions = rsp_dict.get("choices", [{}])[0].get("delta", {}).get("content", "")
+ return completions
+
def _get_completion_from_dict(self, rsp_dict: dict) -> str:
if self.model_type == "j2":
# See https://docs.ai21.com/reference/j2-complete-ref
diff --git a/metagpt/provider/bedrock/utils.py b/metagpt/provider/bedrock/utils.py
index 527cc9037..38950c056 100644
--- a/metagpt/provider/bedrock/utils.py
+++ b/metagpt/provider/bedrock/utils.py
@@ -2,8 +2,6 @@ from metagpt.logs import logger
# max_tokens for each model
NOT_SUUPORT_STREAM_MODELS = {
- # Jamba-Instruct
- "ai21.jamba-instruct-v1:0": 256000,
# Jurassic-2 Mid-v1 and Ultra-v1
# + Legacy date: 2024-04-30 (us-west-2/Oregon)
# + EOL date: 2024-08-31 (us-west-2/Oregon)
@@ -12,6 +10,8 @@ NOT_SUUPORT_STREAM_MODELS = {
}
SUPPORT_STREAM_MODELS = {
+ # Jamba-Instruct
+ "ai21.jamba-instruct-v1:0": 256000,
# Titan Text Large
"amazon.titan-tg1-large": 8000,
# Titan Text G1 - Express