Skip to content

Conversation

SimonMorphy
Copy link

@SimonMorphy SimonMorphy commented May 4, 2025

What type of PR is this?

feat: Support for Grok model in Eino

Check the PR title.

  • This PR title match the format: <type>(optional scope): <description>
  • The description of this PR title is user-oriented and clear enough for others to understand.
  • Attach the PR updating the user documentation if the current PR requires user awareness at the usage level. User docs repo

(Optional) Translate the PR title into Chinese.

feat: 在Eino中支持Grok模型

(Optional) More detailed description for this PR(en: English/zh: Chinese).

en:
This PR adds support for the Grok AI model from X.AI to the Eino framework. The implementation allows users to:

  • Create chat completions with Grok (both synchronous and streaming)
  • Use all major Grok parameters (temperature, topP, topK, maxTokens, etc.)
  • Utilize function/tool calling capabilities
  • Access usage statistics

The implementation follows the same patterns as other model providers in Eino, ensuring consistency and ease of use. A comprehensive example demonstrating all features is included.

zh:
该PR为Eino框架添加了对X.AI的Grok人工智能模型的支持。实现功能包括:

  • 使用Grok创建对话完成(支持同步和流式响应)
  • 使用所有主要的Grok参数(temperature、topP、topK、maxTokens等)
  • 利用函数/工具调用功能
  • 访问使用统计信息

实现遵循Eino中其他模型提供商的相同模式,确保一致性和易用性。包含了展示所有功能的综合示例。

(Optional) Which issue(s) this PR fixes:

(optional) The PR that updates user documentation:

@CLAassistant
Copy link

CLAassistant commented May 4, 2025

CLA assistant check
All committers have signed the CLA.

@meguminnnnnnnnn meguminnnnnnnnn self-assigned this May 12, 2025
@meguminnnnnnnnn
Copy link
Contributor

我大概看了下 api 文档, grok 的 api 应该是和 openai 兼容的?如果是兼容的是不是直接用 openai 就好了

@SimonMorphy
Copy link
Author

我大概看了下 api 文档, grok 的 api 应该是和 openai 兼容的?如果是兼容的是不是直接用 openai 就好了

维护者,您好。

普通的对话接口确实和openai、Anthropic兼容,但像是 Deferred Chat Completions 这类接口就仅支持 RestFul请求,所以引入SDK是必须的,并且我认为在某些场景(例如用Eino创建工作流中的异步调用链)时,这个功能很有用。

另外,在 X.AI 官网也有提到,未来将会开放更多功能,其中就包括:按照时间范围等特定条件从信息平台(例如Twitter)中检索数据,我认为靠openai提供的规范中的字段或许不足以支持这个功能,而这个功能在很多数据爬取的场景下都十分奏效。

综上,我认为Grok以及X.AI所涉及的领域十分契合Eino的开发愿景,或许我引入的客户端SDK并不是很成熟,但我仍希望能让Eino全方面地支持Grok这款强大的AI

@meguminnnnnnnnn
Copy link
Contributor

目前应该没有提供 openai 协议以外的功能? 可以等openai 无法兼容 grok 之后再增加这个封装, 现在加会带来一些不必要的维护成本

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants