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

community(sparkllm): Add function call support in Sparkllm chat model. #20607

Merged
merged 6 commits into from
Aug 29, 2024

Conversation

liugddx
Copy link
Contributor

@liugddx liugddx commented Apr 18, 2024

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Apr 18, 2024
Copy link

vercel bot commented Apr 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
langchain ⬜️ Ignored (Inspect) Visit Preview Aug 29, 2024 2:36pm

@dosubot dosubot bot added 🔌: fireworks Primarily related to Fireworks AI model intergrations 🤖:improvement Medium size change to existing code to handle new use-cases labels Apr 18, 2024
@liugddx liugddx marked this pull request as draft April 18, 2024 14:41
@liugddx liugddx marked this pull request as ready for review April 18, 2024 14:55
@liugddx liugddx changed the title community(spark): Add function call support in Sparkllm chat model. community(sparkllm): Add function call support in Sparkllm chat model. Apr 18, 2024
@eyurtsev eyurtsev self-assigned this Apr 18, 2024
Copy link
Collaborator

@baskaryan baskaryan left a comment

Choose a reason for hiding this comment

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

should we implement the bind_tools method as well

@hwchase17 hwchase17 assigned ccurme and unassigned eyurtsev May 8, 2024
@hwchase17
Copy link
Contributor

assigning to @ccurme, we should have standard tests for chat models for tool calling right?

# If function call only, content is None not empty string
if message_dict["content"] == "":
message_dict["content"] = None
if "tool_calls" in message.additional_kwargs:
Copy link
Collaborator

Choose a reason for hiding this comment

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

@liugddx we should read tool calls off of message.tool_calls here, instead of (or with higher priority than) additional_kwargs.

]
prompt = ChatPromptTemplate(messages=prompt_msgs)

chain = prompt | chat.bind(functions=_FUNCTIONS)
Copy link
Collaborator

Choose a reason for hiding this comment

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

suggest implementing bind_tools for consistency with other chat models. see example here:

formatted_tools = [convert_to_openai_tool(tool) for tool in tools]
return super().bind(tools=formatted_tools, **kwargs)

@ccurme ccurme added the community Related to langchain-community label Jun 18, 2024
@dosubot dosubot bot added the lgtm PR looks good. Use to confirm that a PR is ready for merging. label Aug 29, 2024
@ccurme ccurme enabled auto-merge (squash) August 29, 2024 14:36
@ccurme ccurme merged commit fcf9230 into langchain-ai:master Aug 29, 2024
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Related to langchain-community 🔌: fireworks Primarily related to Fireworks AI model intergrations 🤖:improvement Medium size change to existing code to handle new use-cases lgtm PR looks good. Use to confirm that a PR is ready for merging. size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants