@ai-sdk/xai 0.0.0-70e0935a-20260114150030 → 0.0.0-98261322-20260122142521

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/CHANGELOG.md +64 -5
  2. package/dist/index.js +1 -1
  3. package/dist/index.mjs +1 -1
  4. package/docs/01-xai.mdx +697 -0
  5. package/package.json +11 -6
  6. package/src/convert-to-xai-chat-messages.test.ts +243 -0
  7. package/src/convert-to-xai-chat-messages.ts +142 -0
  8. package/src/convert-xai-chat-usage.test.ts +240 -0
  9. package/src/convert-xai-chat-usage.ts +23 -0
  10. package/src/get-response-metadata.ts +19 -0
  11. package/src/index.ts +14 -0
  12. package/src/map-xai-finish-reason.ts +19 -0
  13. package/src/responses/__fixtures__/xai-code-execution-tool.1.json +68 -0
  14. package/src/responses/__fixtures__/xai-text-streaming.1.chunks.txt +698 -0
  15. package/src/responses/__fixtures__/xai-text-with-reasoning-streaming-store-false.1.chunks.txt +655 -0
  16. package/src/responses/__fixtures__/xai-text-with-reasoning-streaming.1.chunks.txt +679 -0
  17. package/src/responses/__fixtures__/xai-web-search-tool.1.chunks.txt +274 -0
  18. package/src/responses/__fixtures__/xai-web-search-tool.1.json +90 -0
  19. package/src/responses/__fixtures__/xai-x-search-tool.1.json +149 -0
  20. package/src/responses/__fixtures__/xai-x-search-tool.chunks.txt +1757 -0
  21. package/src/responses/__snapshots__/xai-responses-language-model.test.ts.snap +21929 -0
  22. package/src/responses/convert-to-xai-responses-input.test.ts +463 -0
  23. package/src/responses/convert-to-xai-responses-input.ts +206 -0
  24. package/src/responses/convert-xai-responses-usage.ts +24 -0
  25. package/src/responses/map-xai-responses-finish-reason.ts +20 -0
  26. package/src/responses/xai-responses-api.ts +393 -0
  27. package/src/responses/xai-responses-language-model.test.ts +1803 -0
  28. package/src/responses/xai-responses-language-model.ts +732 -0
  29. package/src/responses/xai-responses-options.ts +34 -0
  30. package/src/responses/xai-responses-prepare-tools.test.ts +497 -0
  31. package/src/responses/xai-responses-prepare-tools.ts +226 -0
  32. package/src/tool/code-execution.ts +17 -0
  33. package/src/tool/index.ts +15 -0
  34. package/src/tool/view-image.ts +20 -0
  35. package/src/tool/view-x-video.ts +18 -0
  36. package/src/tool/web-search.ts +56 -0
  37. package/src/tool/x-search.ts +63 -0
  38. package/src/version.ts +6 -0
  39. package/src/xai-chat-language-model.test.ts +1805 -0
  40. package/src/xai-chat-language-model.ts +681 -0
  41. package/src/xai-chat-options.ts +131 -0
  42. package/src/xai-chat-prompt.ts +44 -0
  43. package/src/xai-error.ts +19 -0
  44. package/src/xai-image-settings.ts +1 -0
  45. package/src/xai-prepare-tools.ts +95 -0
  46. package/src/xai-provider.test.ts +167 -0
  47. package/src/xai-provider.ts +162 -0
@@ -0,0 +1,149 @@
1
+ {
2
+ "created_at": 1761768904,
3
+ "id": "84c1a8ea-1f29-4a33-1049-0ed3561b0f64_us-east-1",
4
+ "max_output_tokens": null,
5
+ "model": "grok-4-fast-reasoning",
6
+ "object": "response",
7
+ "output": [
8
+ {
9
+ "arguments": "{\"query\":\"AI artificial intelligence\",\"limit\":20,\"from_date\":\"2025-10-01\",\"to_date\":\"2025-10-29\",\"min_score_threshold\":0.2}",
10
+ "call_id": "",
11
+ "name": "x_semantic_search",
12
+ "type": "x_search_call",
13
+ "id": "fc_84c1a8ea-1f29-4a33-1049-0ed3561b0f64_us-east-1_0",
14
+ "status": "completed"
15
+ },
16
+ {
17
+ "content": [
18
+ {
19
+ "type": "output_text",
20
+ "text": "### What People Are Saying About AI on X (as of Late October 2025)\n\nBased on recent posts on X (formerly Twitter), discussions about AI are buzzing with a mix of excitement, technical deep dives, and cautious optimism. The conversation heavily revolves around **Artificial General Intelligence (AGI)** as the holy grail of AI development, with frequent references to a new paper from AI luminaries like Yoshua Bengio, Eric Schmidt, Gary Marcus, and Max Tegmark. People are debating definitions, progress, limitations, and real-world applications. Here's a breakdown of the main themes from the top relevant posts (focusing on the last month):\n\n#### 1. **Defining AGI and Its Distance from Current AI**\n - A huge focus is on clarifying what AGI really means. Multiple users cite the aforementioned paper, which defines AGI as an AI system that \"matches or exceeds the cognitive versatility and proficiency of a well-educated adult\" across 10 core cognitive areas (e.g., reasoning, memory, math, language, perception).\n - Example: @jiqizhixin shared the paper, noting that models like GPT-4 and GPT-5 score poorly (e.g., 0% on long-term memory), emphasizing AGI isn't here yet.\n - @alex_prompter broke it down simply: GPT-4 is at 27% toward AGI, GPT-5 at 58%, but gaps in continuous learning persist. They called it a \"clear benchmark\" without hype.\n - @AskPerplexity and @flowersslop echoed this, describing AGI as broadly adaptable like humans, not just narrow tools like today's chatbots.\n - ASI (Artificial Superintelligence) gets mentioned as the next step beyond AGI—AI surpassing humans in *all* domains, including creativity and strategy. @SciTechera tied it to the \"Singularity,\" where AI self-improves uncontrollably.\n - Skepticism: @Newaxeman called AI an \"advanced search engine\" aggregating conventional wisdom, questioning deeper intelligence claims.\n\n#### 2. **Progress and Timelines Toward AGI**\n - Optimism is high but grounded. @bindureddy (CEO of Abacus.AI) boldly predicted AGI (AI replacing humans in digital tasks) is \"just a couple of years away,\" citing missing pieces like context, tools, and self-awareness that labs are tackling.\n - @slow_developer referenced OpenAI and DeepMind's 5-level AGI framework: Current models are past Level 2 (emerging intelligence) and into early Level 3 (competent in complex tasks with supervision), but not fully autonomous yet.\n - @timmur_ stressed AGI requires efficient learning across open-ended tasks with minimal data—something no model achieves today, but \"we will solve it eventually.\"\n - Broader view: @FrnkNlsn recommended the book *Artificial Intelligence: A Modern Approach* by Russell and Norvig for a comprehensive overview, highlighting topics like knowledge representation and multi-agent systems.\n\n#### 3. **Types of AI and Distinctions**\n - Users are educating on AI's varieties to cut through confusion:\n - @y00ngipurrs differentiated analytical AI (e.g., for medicine, fraud detection) from generative AI (e.g., ChatGPT for text/art).\n - @techyoutbe contrasted AI agents (task-specific automators) with \"agentic AI\" (autonomous systems for long-term planning and multi-domain reasoning).\n - @SukhSandhu listed what AI *is* (data processor, pattern recognizer, task automator) vs. what it's *not* (conscious, emotional, intuitively moral). They warned of biases in training data.\n - @AITECHio hyped proactive \"AI agents\" that set goals and execute workflows autonomously, predicting one for every task from finance to on-chain automation.\n\n#### 4. **Applications, Projects, and Broader Impacts**\n - AI's practical side shines in Web3 and business contexts. @O_H_JAY highlighted crypto projects advancing AGI/ASI, like @SentientAGI (decentralized AGI networks), @AGI_XT (AI automation on Solana), and @StoryProtocol (on-chain IP for AI models). They urged getting in early during market dips.\n - @Voa_De_Voa discussed combining AI with compute and robotics for \"autonomous intelligence,\" but flagged centralized control as a risk.\n - @DeviprasadSD positioned AGI as a future horizon for reasoning across any task, still in research.\n - @zolayolanetwork and @davilagrau amplified the AGI definition paper, linking it to blockchain and cognitive tools.\n\n#### Overall Sentiment\n- **Positive/Visionary**: Excitement about AI augmenting human capabilities (e.g., @hailstorm_9 called AGI \"augmentation, not automation\"). Many see it transforming industries like healthcare, finance, and creative work.\n- **Cautious/Realistic**: Emphasis on limitations—current AI is \"narrow\" and lacks true understanding or adaptability. No one's claiming AGI is imminent without caveats.\n- **Volume and Engagement**: These posts garnered thousands of likes/views, with high engagement on definitions and project lists. Discussions are technical but accessible, often with images, threads, or links to papers/arXiv.\n\nThis is a snapshot from ~20 recent, highly relevant posts. AI chatter on X is evolving fast—trends like AGI benchmarks and agentic systems are dominating. If you want deeper dives into specific posts, users, or subtopics (e.g., AI ethics or tools), let me know!",
21
+ "logprobs": [],
22
+ "annotations": [
23
+ {
24
+ "type": "url_citation",
25
+ "url": "https://x.com/i/status/1982033415697514642"
26
+ },
27
+ {
28
+ "type": "url_citation",
29
+ "url": "https://x.com/i/status/1983126826739228851"
30
+ },
31
+ {
32
+ "type": "url_citation",
33
+ "url": "https://x.com/i/status/1978543466042040366"
34
+ },
35
+ {
36
+ "type": "url_citation",
37
+ "url": "https://x.com/i/status/1982845451188720069"
38
+ },
39
+ {
40
+ "type": "url_citation",
41
+ "url": "https://x.com/i/status/1981716983168040972"
42
+ },
43
+ {
44
+ "type": "url_citation",
45
+ "url": "https://x.com/i/status/1977864424770990183"
46
+ },
47
+ {
48
+ "type": "url_citation",
49
+ "url": "https://x.com/i/status/1979019210870395155"
50
+ },
51
+ {
52
+ "type": "url_citation",
53
+ "url": "https://x.com/i/status/1981725084059668849"
54
+ },
55
+ {
56
+ "type": "url_citation",
57
+ "url": "https://x.com/i/status/1982159004857217324"
58
+ },
59
+ {
60
+ "type": "url_citation",
61
+ "url": "https://x.com/i/status/1982984027209630067"
62
+ },
63
+ {
64
+ "type": "url_citation",
65
+ "url": "https://x.com/i/status/1979140575476764920"
66
+ },
67
+ {
68
+ "type": "url_citation",
69
+ "url": "https://x.com/i/status/1978340270413377544"
70
+ },
71
+ {
72
+ "type": "url_citation",
73
+ "url": "https://x.com/i/status/1975597769089032357"
74
+ },
75
+ {
76
+ "type": "url_citation",
77
+ "url": "https://x.com/i/status/1979729023413670239"
78
+ },
79
+ {
80
+ "type": "url_citation",
81
+ "url": "https://x.com/i/status/1979892126969209017"
82
+ },
83
+ {
84
+ "type": "url_citation",
85
+ "url": "https://x.com/i/status/1974520747503792531"
86
+ },
87
+ {
88
+ "type": "url_citation",
89
+ "url": "https://x.com/i/status/1977071347584135287"
90
+ },
91
+ {
92
+ "type": "url_citation",
93
+ "url": "https://x.com/i/status/1983115564005626367"
94
+ },
95
+ {
96
+ "type": "url_citation",
97
+ "url": "https://x.com/i/status/1981679355345686727"
98
+ },
99
+ {
100
+ "type": "url_citation",
101
+ "url": "https://x.com/i/status/1982892944261582868"
102
+ }
103
+ ]
104
+ }
105
+ ],
106
+ "id": "msg_84c1a8ea-1f29-4a33-1049-0ed3561b0f64_us-east-1",
107
+ "role": "assistant",
108
+ "type": "message",
109
+ "status": "completed"
110
+ }
111
+ ],
112
+ "parallel_tool_calls": true,
113
+ "previous_response_id": null,
114
+ "reasoning": {
115
+ "effort": null,
116
+ "summary": null
117
+ },
118
+ "temperature": null,
119
+ "text": {
120
+ "format": {
121
+ "type": "text"
122
+ }
123
+ },
124
+ "tool_choice": "auto",
125
+ "tools": [
126
+ {
127
+ "type": "x_search"
128
+ }
129
+ ],
130
+ "top_p": null,
131
+ "usage": {
132
+ "input_tokens": 8397,
133
+ "input_tokens_details": {
134
+ "cached_tokens": 608
135
+ },
136
+ "output_tokens": 1805,
137
+ "output_tokens_details": {
138
+ "reasoning_tokens": 580
139
+ },
140
+ "total_tokens": 10202,
141
+ "num_sources_used": 0,
142
+ "num_server_side_tools_used": 1
143
+ },
144
+ "user": null,
145
+ "incomplete_details": null,
146
+ "status": "completed",
147
+ "store": true,
148
+ "metadata": {}
149
+ }