You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: libs/providers/langchain-xai/README.md
+150Lines changed: 150 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,6 +31,156 @@ const message = new HumanMessage("What color is the sky?");
31
31
const res =awaitmodel.invoke([message]);
32
32
```
33
33
34
+
## Server Tool Calling (Live Search)
35
+
36
+
xAI supports server-side tools that are executed by the API rather than requiring client-side execution. The `live_search` tool enables the model to search the web for real-time information.
37
+
38
+
### Using the built-in live_search tool
39
+
40
+
```typescript
41
+
import { ChatXAI, tools } from"@langchain/xai";
42
+
43
+
const model =newChatXAI({
44
+
model: "grok-2-1212",
45
+
});
46
+
47
+
// Create the built-in live_search tool with optional parameters
0 commit comments