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
this knowledge connects to X AI. `files` in `next(input::String; files=[])::String` is currently unused (not yet implemented).
2
+
this knowledge connects to X AI. `files` in `next(input::String; files=[])::String` now supports image file paths (jpg/png) by encoding them as base64 data URLs for vision capabilities.
3
3
"""
4
4
5
5
import Pkg
6
-
Pkg.add(["HTTP", "JSON"])
7
-
using HTTP, JSON
6
+
Pkg.add(["HTTP", "JSON", "Base64"])
7
+
using HTTP, JSON, Base64
8
8
9
9
@api MAX_OUTPUT_TOKENS =10000
10
10
11
-
function callXAIAPI(api_key::String, system_prompt::String, user_prompt::String; model::String="grok-4", max_tokens::Int)::String
11
+
function callXAIAPI(api_key::String, system_prompt::String, messages::Vector{Dict{String, Any}}; model::String="grok-4", max_tokens::Int)::String
12
12
url ="https://api.x.ai/v1/chat/completions"
13
13
14
14
headers = [
@@ -18,23 +18,46 @@ function callXAIAPI(api_key::String, system_prompt::String, user_prompt::String;
0 commit comments