Skip to content

The agent engineering platform.

Amadeus toolkit minor update (#13002)

MinjiKa1a11ffd78c8
diff --git a/docs/docs/integrations/toolkits/amadeus.ipynb b/docs/docs/integrations/toolkits/amadeus.ipynb
index 7d0a118f7a..a05604def3 100644
--- a/docs/docs/integrations/toolkits/amadeus.ipynb
+++ b/docs/docs/integrations/toolkits/amadeus.ipynb
@@ -6,9 +6,13 @@
"source": [
"# Amadeus\n",
"\n",
- "This notebook walks you through connecting LangChain to the `Amadeus` travel information API\n",
+ "This notebook walks you through connecting LangChain to the `Amadeus` travel APIs.\n",
"\n",
- "To use this toolkit, you will need to set up your credentials explained in the [Amadeus for developers getting started overview](https://developers.amadeus.com/get-started/get-started-with-self-service-apis-335). Once you've received a AMADEUS_CLIENT_ID and AMADEUS_CLIENT_SECRET, you can input them as environmental variables below."
+ "This `Amadeus` toolkit allows agents to make decision when it comes to travel, especially searching and booking trips with flights.\n",
+ "\n",
+ "To use this toolkit, you will need to have your Amadeus API keys ready, explained in the [Get started Amadeus Self-Service APIs](https://developers.amadeus.com/get-started/get-started-with-self-service-apis-335). Once you've received a AMADEUS_CLIENT_ID and AMADEUS_CLIENT_SECRET, you can input them as environmental variables below.\n",
+ "\n",
+ "Note: Amadeus Self-Service APIs offers a test enviornment with [free limited data](https://amadeus4dev.github.io/developer-guides/test-data/). This allows developers to build and test their applications before deploying them to production. To access real-time data, you will need to [move to the production environment](https://amadeus4dev.github.io/developer-guides/API-Keys/moving-to-production/)."
]
},
{
@@ -40,7 +44,8 @@
"\n",
"os.environ[\"AMADEUS_CLIENT_ID\"] = \"CLIENT_ID\"\n",
"os.environ[\"AMADEUS_CLIENT_SECRET\"] = \"CLIENT_SECRET\"\n",
- "os.environ[\"OPENAI_API_KEY\"] = \"API_KEY\""
+ "os.environ[\"OPENAI_API_KEY\"] = \"API_KEY\"\n",
+ "# os.environ[\"AMADEUS_HOSTNAME\"] = \"production\" or \"test\""
]
},
{
diff --git a/libs/langchain/langchain/agents/agent_toolkits/amadeus/toolkit.py b/libs/langchain/langchain/agents/agent_toolkits/amadeus/toolkit.py
index c1dd29925b..b87a917952 100644
--- a/libs/langchain/langchain/agents/agent_toolkits/amadeus/toolkit.py
+++ b/libs/langchain/langchain/agents/agent_toolkits/amadeus/toolkit.py
@@ -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)
diff --git a/libs/langchain/langchain/tools/amadeus/flight_search.py b/libs/langchain/langchain/tools/amadeus/flight_search.py
index 603a397a7d..2276f9a72b 100644
--- a/libs/langchain/langchain/tools/amadeus/flight_search.py
+++ b/libs/langchain/langchain/tools/amadeus/flight_search.py
@@ -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,
diff --git a/libs/langchain/langchain/tools/amadeus/utils.py b/libs/langchain/langchain/tools/amadeus/utils.py
index 51e0740615..7c04ec0528 100644
--- a/libs/langchain/langchain/tools/amadeus/utils.py
+++ b/libs/langchain/langchain/tools/amadeus/utils.py
@@ -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