mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-22 19:09:57 +00:00
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:
@@ -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)
|
||||
|
||||
|
@@ -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,
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user