Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added apicaller tool to make calls using OpenAPI specification #1508

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Romamo
Copy link

@Romamo Romamo commented Dec 3, 2024

I'm using a full-featured generated swagger client to make API requests. This seems more convenient and flexible than LangChain's approach, which extracts GET/POST requests from the specification.

As the author of this library https://github.com/Romamo/pyapicaller I plan to add new formats and automatically improve poorly documented APIs by adapting them to AI.

@debianmaster
Copy link

@Romamo i think some steps related to generating swagger/openapi client sdk are missing in the steps. could you please add?

@ysolanky
Copy link
Contributor

ysolanky commented Jan 8, 2025

Hello @Romamo!

I am having trouble testing the cookbook:
image

The swagger_clients directory was created and populated but the tool is not being executed.

@Romamo
Copy link
Author

Romamo commented Jan 9, 2025

The swagger_clients directory was created and populated but the tool is not being executed.

Thank you. When you run a script using an absolute path, such as: python cookbook/tools/apicaller_tools.py Python does not add the directory of the script to sys.path.

To resolve this, you can manually add the directory to sys.path, set it in the PATH environment variable, or provide it as an argument:

agent = Agent(tools=[ApiCaller(CLIENT_PACKAGE, OPENAPI_SPEC,
                               path='path to swagger_client directory')],
              show_tool_calls=True)

However, the best practice is to run the example script as a module using Python's -m option:

python -m cookbook.tools.apicaller_tools

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants