Skip to content

Commit

Permalink
Revert list model changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Lloyd Hamilton committed Jan 12, 2025
1 parent 1abea9e commit f9d46e3
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions adalflow/adalflow/components/model_client/bedrock_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
from botocore.config import Config

log = logging.getLogger(__name__)
log.level = logging.DEBUG

bedrock_runtime_exceptions = boto3.client(
service_name="bedrock-runtime",
Expand Down Expand Up @@ -174,7 +173,7 @@ def handle_stream_response(self, stream: dict) -> GeneratorType:
yield chunk
except Exception as e:
print(f"Error in handle_stream_response: {e}") # Debug print
raise
raise from e

def parse_chat_completion(self, completion: dict) -> "GeneratorOutput":
"""Parse the completion, and put it into the raw_response."""
Expand Down Expand Up @@ -203,14 +202,14 @@ def list_models(self):

try:
response = self._client.list_foundation_models()
models = response.get("modelSummaries", [])
models = response.get("models", [])
for model in models:
print(f"Model ID: {model['modelId']}")
print(f" Name: {model['modelName']}")
print(f" Input Modalities: {model['inputModalities']}")
print(f" Output Modalities: {model['outputModalities']}")
print(f" Provider: {model['providerName']}")
print(f" Name: {model['name']}")
print(f" Description: {model['description']}")
print(f" Provider: {model['provider']}")
print("")

except Exception as e:
print(f"Error listing models: {e}")

Expand Down Expand Up @@ -255,7 +254,6 @@ def call(
if model_type == ModelType.LLM:
if "stream" in api_kwargs and api_kwargs.get("stream", False):
log.debug("Streaming call")
printc("Streaming")
api_kwargs.pop("stream") # stream is not a valid parameter for bedrock
self.chat_completion_parser = self.handle_stream_response
return self.sync_client.converse_stream(**api_kwargs)
Expand Down

0 comments on commit f9d46e3

Please sign in to comment.