Repository navigation
feat(llama-index): llama-index-llms-blockrun, paying on Base or Solana - #79
Merged
Merged
Conversation
A LlamaIndex LLM for any BlockRun chat model, published from integrations/llama-index-llms-blockrun as its own PyPI package. OpenAILike(api_base=..., api_key="fake") reaches the gateway and stops at the first 402: nothing in the OpenAI client can sign the payment. BlockRun hands every request to this SDK instead, so payment, spend caps and the no-double-pay retry rules are the SDK's, not a second copy of them. - chain="base" (default) uses LLMClient/AsyncLLMClient; chain="solana" uses SolanaLLMClient/AsyncSolanaLLMClient (the [solana] extra). - FunctionCallingLLM: chat, stream, async, tool calling, predict_and_call, FunctionAgent. Messages serialize through llama-index-llms-openai's own to_openai_message_dicts. - The private key is a PrivateAttr, never a field, so to_dict()/to_json() and callback logs cannot carry it. - temperature is unset by default: several reasoning models accept only their own. - context_window is read once from /v1/models; failure is cached and falls back to LlamaIndex's default with a warning. - Solana's client takes no **extra, so an unknown request parameter is refused up front, naming it, instead of a TypeError inside the SDK. - One async client per running event loop: an httpx.AsyncClient cached across asyncio.run() calls fails with "Event loop is closed". - ThinkingBlocks are stripped before serializing: llama-index-llms-openai 0.6.5 raises on them. CI gets a llama-index job at the floor pins (core 0.14.5, openai 0.6.5, py3.10) and at current (py3.12), against this checkout of the SDK. Releases tagged llama-index-llms-blockrun-v* publish through publish-llama-index.yml; publish.yml skips them, and the SDK sdist now excludes integrations/. Verified live on both chains with deepseek/deepseek-chat: chat, stream, acomplete, astream_chat, predict_and_call and a FunctionAgent run.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
llama-index-llms-blockrun— a LlamaIndex LLM for any BlockRun chat model, living atintegrations/llama-index-llms-blockrunand published as its own PyPI package.Why a package and not an
OpenAILikesnippetContext: run-llama/llama_index#23236.
OpenAILike(api_base=..., api_key="fake")reaches the gateway and stops at the first 402 — nothing in the OpenAI client can sign a payment. LlamaIndex's CONTRIBUTING now asks for new provider integrations to live in their own repo and publish independently, so it lives here, next to the SDK it wraps, and CI tests it against this checkout.Design
chain="base"→LLMClient/AsyncLLMClient;chain="solana"→SolanaLLMClient/AsyncSolanaLLMClient([solana]extra). Payment,max_cost_per_calland retry rules stay in the SDK.FunctionCallingLLM: chat, stream, async, tool calling,predict_and_call,FunctionAgent. Serialization reusesllama-index-llms-openai'sto_openai_message_dicts.PrivateAttr— never serialized byto_dict()/ callbacks.temperatureunset by default (reasoning models reject non-default values).context_windowread once from/v1/models; cached, falls back with a warning.**extra: unknown params are refused up front by name.asyncio.run()→ "Event loop is closed").llama-index-llms-openai0.6.5 raises on them).CI / release
llama-indexCI job: floor pins (core 0.14.5, openai 0.6.5, py3.10) and current (py3.12).publish-llama-index.ymlpublishes on releases taggedllama-index-llms-blockrun-v*;publish.ymlnow skips those tags. SDK sdist excludesintegrations/.llama-index-llms-blockrun→ repoBlockRunAI/blockrun-llm, workflowpublish-llama-index.yml, environmentpypi.Verification
deepseek/deepseek-chat: chat, stream,acomplete,astream_chat,predict_and_call, and aFunctionAgentrun (1234 × 4567 = 5,635,678).🤖 Generated with Claude Code