Closed Chance-Obondo closed 1 month ago
@Chance-Obondo this works for me on the main branch but it could indeed not be working on old release of haystack-experimental (v0.1.1). We are about to release a new version of experimental but until then please try with pip install git+https://github.com/deepset-ai/haystack-experimental
, export OPENAI_API_KEY and then run:
from haystack.dataclasses import ChatMessage
from haystack_experimental.components.tools.openapi import OpenAPITool, LLMProvider
tool = OpenAPITool(generator_api=LLMProvider.OPENAI, spec="https://raw.githubusercontent.com/open-meteo/open-meteo/main/openapi.yml")
tool.run(messages=[ChatMessage.from_user("Weather in San Francisco, US")])
I just tried it and I get:
{'service_response': [ChatMessage(content='{"latitude": 37.763283, "longitude": -122.41286, "generationtime_ms": 0.07796287536621094, "utc_offset_seconds": 0, "timezone": "GMT", "timezone_abbreviation": "GMT", "elevation": 18.0, "current_weather_units": {"time": "iso8601", "interval": "seconds", "temperature": "\\u00b0C", "windspeed": "km/h", "winddirection": "\\u00b0", "is_day": "", "weathercode": "wmo code"}, "current_weather": {"time": "2024-09-24T09:15", "interval": 900, "temperature": 16.3, "windspeed": 6.5, "winddirection": 289, "is_day": 0, "weathercode": 0}}', role=<ChatRole.USER: 'user'>, name=None, meta={})]}
Let us know 🙏
Thank you! It has worked on my end, is there a way maybe the documentation on colab can be updated and also on github so that anyone else trying to experiment can know there's some updates?
Thank you! It has worked on my end, is there a way maybe the documentation on colab can be updated and also on github so that anyone else trying to experiment can know there's some updates?
It would be a moot update as the new release is imminent - should be literally today. Please keep trying OpenAPITool @Chance-Obondo - your feedback is going to be immensely valuable.
Recommend closing @julian-risch
Thank you! It has worked on my end, is there a way maybe the documentation on colab can be updated and also on github so that anyone else trying to experiment can know there's some updates?
It would be a moot update as the new release is imminent - should be literally today. Please keep trying OpenAPITool @Chance-Obondo - your feedback is going to be immensely valuable.
Also, even though sometimes an OpenAPI spec for a certain REST endpoint is not available - you can usually generate it using its documentation and AI generation tools, making it easier to integrate REST endpoints with your Haystack-based LLM app.
A new release of haystack-experimental is out. This issue is now officially fixed, closing as "Fixed"!
I am getting the mentioned error when trying to test the OpenAPI tool, not sure how to go about it.
My code: ` import os from haystack.dataclasses import ChatMessage from haystack_experimental.components.tools.openapi import OpenAPITool, LLMProvider from haystack.utils import Secret os.environ["OPENAI_API_KEY"]=""
os.environ["SERPERDEV_API_KEY"]=""
tool = OpenAPITool(generator_api=LLMProvider.OPENAI, spec="https://raw.githubusercontent.com/open-meteo/open-meteo/main/openapi.yml")
tool.run(messages=[ChatMessage.from_user("Weather in San Francisco, US")])`
The error:
TypeError: 'dict' object is not callable