Amadeus toolkit minor update (#13002)

- update `Amadeus` toolkit with ability to switch Amadeus environments 
- update minor code explanations

---------

Co-authored-by: MinjiK <minji.kim@amadeus.com>
This commit is contained in:
MinjiK
2023-12-06 05:08:34 +01:00
committed by GitHub
parent b05c46074b
commit a1a11ffd78
4 changed files with 15 additions and 6 deletions

View File

@@ -15,7 +15,7 @@ if TYPE_CHECKING:
class AmadeusToolkit(BaseToolkit):
"""Toolkit for interacting with Amadeus which offers APIs for travel search."""
"""Toolkit for interacting with Amadeus which offers APIs for travel."""
client: Client = Field(default_factory=authenticate)

View File

@@ -96,7 +96,7 @@ class AmadeusFlightSearch(AmadeusBaseTool):
)
return [None]
# Collect all results from the API
# Collect all results from the Amadeus Flight Offers Search API
try:
response = client.shopping.flight_offers_search.get(
originLocationCode=originLocationCode,

View File

@@ -33,6 +33,10 @@ def authenticate() -> Client:
)
return None
client = Client(client_id=client_id, client_secret=client_secret)
hostname = "test" # Default hostname
if "AMADEUS_HOSTNAME" in os.environ:
hostname = os.environ["AMADEUS_HOSTNAME"]
client = Client(client_id=client_id, client_secret=client_secret, hostname=hostname)
return client