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

Add OCI Generative AI tool calling support #16888

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

Conversation

LejianLeoHe7
Copy link

Description

Adding tool calling support for chat models offered by OCI Generative AI services.
This is an update to our last PR #14080.

Fixes # (issue)
N/A

New Package?

No

Did I fill in the tool.llamahub section in the pyproject.toml and provide a detailed README.md for my new integration or package?

  • Yes
  • No

Version Bump?

Did I bump the version in the pyproject.toml file of the package I am updating? (Except for the llama-index-core package)

  • Yes
  • No

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • I added new unit tests to cover this change
  • I believe this change is already covered by existing unit tests

Suggested Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added Google Colab support for the newly added notebooks.
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I ran make format; make lint to appease the lint gods

@dosubot dosubot bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Nov 8, 2024
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@@ -219,6 +190,7 @@ def _get_all_kwargs(self, **kwargs: Any) -> Dict[str, Any]:
**kwargs,
}

@deprecated("Deprecated in favor of `chat`, which should be used instead.")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

technically, you can make complete call chat -- we have utils to make this very easy. A few llms do this

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @logan-markewich Agreed. But basically all the models that support completion have been deprecated in our service. Let me take a look at other vendors.

async def achat(
self, messages: Sequence[ChatMessage], **kwargs: Any
) -> ChatResponse:
# do synchronous chat for now
return self.chat(messages, **kwargs)
raise NotImplementedError("Async chat is not implemented yet.")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no async client methods we can implement?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@logan-markewich Our Python SDK doesn't have async support natively. We probably need to re-evaluation how we gonna implement async. Probably will be another PR as well.

**chat_params,
}

def chat_with_tools(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically you shouldn't need to implement chat_with_tools or stream_chat_with_tools -- the idea is that chat and stream chat already handle tools being passed in/out, and all you need to implement is _prepare_chat_with_tools() and get_tool_calls_from_response() and maybe _validate_chat_with_tools_response()

Check out anthropic or Ollama for a decent example of this

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:XL This PR changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants