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

fix: Update OpenAPIServiceConnector to new ChatMessage #8817

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

Conversation

vblagoje
Copy link
Member

@vblagoje vblagoje commented Feb 5, 2025

Why:

Update OpenAPIServiceConnector to handle new ChatMessage format

What:

  • Patched the request method in OpenAPI to handle raw responses more effectively.
  • Reworked the processing of chat messages to extract tool calls and handle them for OpenAPI function invocations.

How can it be used:

The changes affect how OpenAPIServiceConnector handles new ChatMessage format involving build in tool_calls property.

Example usage:

connector.run(messages=[message], service_openapi_spec=a_spec_as_a_dict_object)

Where message should now contain tool_calls property.

How did you test it:

Tests verify new behavior of message processing with checks for valid tool calls. Patched OpenAPI methods are mocked to assess correct invocation and response handling. Integration tests are skipped unless specific API keys are set.

Notes for the reviewer:

Pay special attention to the new patch applied to the request method of OpenAPI, specifically concerning raw response handling. Ensure the test coverage is sufficient for edge cases in tool call processing and response verification.

@github-actions github-actions bot added topic:tests type:documentation Improvements on the docs labels Feb 5, 2025
@coveralls
Copy link
Collaborator

coveralls commented Feb 5, 2025

Pull Request Test Coverage Report for Build 13162113609

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 61 unchanged lines in 3 files lost coverage.
  • Overall coverage decreased (-0.5%) to 90.814%

Files with Coverage Reduction New Missed Lines %
components/embedders/sentence_transformers_document_embedder.py 2 96.77%
components/embedders/sentence_transformers_text_embedder.py 2 96.3%
components/connectors/openapi_service.py 57 61.22%
Totals Coverage Status
Change from base Build 13141979385: -0.5%
Covered Lines: 8947
Relevant Lines: 9852

💛 - Coveralls

@vblagoje
Copy link
Member Author

vblagoje commented Feb 5, 2025

@richardpaulhudson would you please give this branch a spin in your project by directly installing it via pip install git+https://github.com/deepset-ai/haystack.git@open_api_chat_message

@vblagoje vblagoje marked this pull request as ready for review February 5, 2025 16:34
@vblagoje vblagoje requested review from a team as code owners February 5, 2025 16:34
@vblagoje vblagoje requested review from dfokina and mpangrazzi and removed request for a team February 5, 2025 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic:tests type:documentation Improvements on the docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OpenAPIServiceConnector does not support the v2.9.x ChatMessage structure
2 participants