Skip to content

OpenAI ChatClient tools support #299

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

Closed
wants to merge 8 commits into from

Conversation

tzolov
Copy link
Contributor

@tzolov tzolov commented Feb 6, 2024

Add support for ChatClient function calling.

  • Add generic (model) ToolFunctionCallback and AbstractToolFunctionCallback abstractions for defining and registering function callbacks with the ChatClient.
  • OpenAiChatClient Function calling implementation.
  • Unit/IT tests for OpenAiApi and OpenAiChatClient function calling.
  • Add function calling docs.

@tzolov tzolov added the enhancement New feature or request label Feb 6, 2024
@tzolov tzolov added this to the 0.8.0 milestone Feb 6, 2024
@tzolov tzolov force-pushed the openai-tools-support branch from fb3e0f5 to 144fa5d Compare February 10, 2024 18:06
@@ -35,4 +38,12 @@ public interface ChatOptions extends ModelOptions {

void setTopK(Integer topK);

default List<ToolFunctionCallback> getToolCallbacks() {
throw new UnsupportedOperationException("ToolCallbacks is not supported by this model");
Copy link
Member

Choose a reason for hiding this comment

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

I think we should not have this default method, since the methods here should apply to every model.

throw new UnsupportedOperationException("ToolCallbacks is not supported by this model");
}

default void setToolCallbacks(List<ToolFunctionCallback> toolCallbacks) {
Copy link
Member

Choose a reason for hiding this comment

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

same comment as before

@@ -82,4 +82,9 @@ public ChatResponseMetadata getMetadata() {
return this.chatResponseMetadata;
}

@Override
public String toString() {
Copy link
Member

Choose a reason for hiding this comment

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

added equals and hashcode on merge.

@markpollack
Copy link
Member

removed the default methods in the chat option interface to make tests pass.

Merged as ffd8222

Can review the small comments in this PR afterwards

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

Successfully merging this pull request may close these issues.

2 participants