Overview
Integration details
Class | Package | Local | Serializable | JS support | Downloads | Version |
---|---|---|---|---|---|---|
GraphTool | langchain-writer | ❌ | ❌ | ❌ | ||
TranslationTool | langchain-writer | ❌ | ❌ | ❌ | ||
WebSearchTool | langchain-writer | ❌ | ❌ | ❌ |
Features
ChatWriter
supports several tool types: function
, graph
, translation
, and web_search
.
Important limitation: You can only use one WRITER tool (translation, graph, web_search, llm, image, vision) at a time. While you can’t combine multiple WRITER tools, you can use one WRITER tool alongside multiple custom function tools.
Function
Functions are the most common type of tool, which allows the LLM to call external APIs, fetch data from databases, and generally perform any external action you want to do. Visit WRITER’s tool calling docs for additional information.Graph
TheGraph
tool uses WRITER’s Knowledge Graph, which is a graph-based retrieval-augmented generation (RAG) system. When using this tool, developers provide a graph ID that references their specific Knowledge Graph. The model then uses this graph to find relevant information and generate accurate answers to questions in the prompt. This allows the model to access and utilize custom knowledge bases during conversations. For more details, see WRITER’s Knowledge Graph API docs.
Translation
The translation tool allows you to translate text during a conversation with a Palmyra model. While Palmyra X models can perform translation tasks, they are not optimized for these tasks and may not perform well without correct prompting. See WRITER’s translation API docs for more information.Web Search
The web search tool allows you to search the web for current information during a conversation with a Palmyra model. While Palmyra models have extensive knowledge, they may not have access to the most current information or real-time data. The web search tool enables your AI assistant to find up-to-date information, news, and facts from the web. See WRITER’s web search API docs for more information.Setup
Sign up for WRITER AI Studio to generate an API key (you can follow this Quickstart). Then, set theWRITER_API_KEY
environment variable:
Usage
You can bind graph or function tools toChatWriter
.
Graph Tools
To bind graph tools, first create and initialize aGraphTool
instance with the graph_ids
you want to use as sources:
Translation Tools
The translation tool allows you to translate text during a conversation with a Palmyra model. While Palmyra X models can perform translation tasks, they are not optimized for these tasks and may not perform well without correct prompting. To use the translation tool, import and initialize the built-inTranslationTool
:
Web Search Tools
The web search tool allows you to search the web for current information during a conversation with a Palmyra model. While Palmyra models have extensive knowledge, they may not have access to the most current information or real-time data. The web search tool enables your AI assistant to find up-to-date information, news, and facts from the web. To use the web search tool, import and initialize the built-inWebSearchTool
:
Instantiation
Binding tools
Important note: WRITER only allows a single WRITER tool (translation, graph, web_search, llm, image, vision) to be bound at a time. You cannot bind multiple WRITER tools simultaneously. However, you can bind multiple custom function tools along with one WRITER tool.Invocation
The model will automatically choose the tool during invocation with all modes (streaming/non-streaming, sync/async).GraphTool
, the model will call it remotely and return usage info in the additional_kwargs
under the graph_data
key:
content
attribute contains the final response:
Chaining
The WRITER Graph tool works differently from other tools; when used, the WRITER server automatically handles calling the Knowledge Graph and generating responses using RAG. Because of this automated server-side handling, you cannot invoke theGraphTool
independently or use it as part of a LangChain chain. You must use the GraphTool
directly with a ChatWriter
instance as shown in the examples above.
API reference
For detailed documentation of allGraphTool
features and configurations, head to the API reference.