Skip to content

SlackToolkit Problem - sample code does not work #28989

@ccurme

Description

@ccurme

Discussed in https://github.com/langchain-ai/langchain/discussions/28566

Originally posted by edwardgonen December 6, 2024

Checked other resources

  • I added a very descriptive title to this question.
  • I searched the LangChain documentation with the integrated search.
  • I used the GitHub search to find a similar question and didn't find it.

Commit to Help

  • I commit to help with one of those options 👆

Example Code

from langchain_community.agent_toolkits import SlackToolkit

toolkit = SlackToolkit()

Description

I have the
SLACK_USER_TOKEN= set correctly and installed all the needed packages including slack_sdk
But the SlackToolkin() gives exception:
Exception has occurred: PydanticUserError
SlackToolkit is not fully defined; you should define WebClient, then call SlackToolkit.model_rebuild().

For further information visit https://errors.pydantic.dev/2.10/u/class-not-fully-defined
File "/Users/user/Projects/slack/main.py", line 13, in
toolkit = SlackToolkit()
^^^^^^^^^^^^^^
pydantic.errors.PydanticUserError: SlackToolkit is not fully defined; you should define WebClient, then call SlackToolkit.model_rebuild().

For further information visit https://errors.pydantic.dev/2.10/u/class-not-fully-defined

I've tried to add WebClient but then fail on get_tools().

Can anyone help?

System Info

langchain==0.3.8
langchain-anthropic==0.3.0
langchain-community==0.3.8
langchain-core==0.3.21
langchain-experimental==0.3.3
langchain-openai==0.2.10
langchain-text-splitters==0.3.2

MAC

Python 3.12.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugRelated to a bug, vulnerability, unexpected error with an existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions