Skip to main content

llama-index llms stepfun integration

Project description

LlamaIndex LLM Integration: Stepfun

Installation

To install the required packages, run:

%pip install llama-index-llms-stepfun
!pip install llama-index

Setup

Initialize StepFun LLM

First, import the necessary libraries and set up your StepFun instance. Replace step-1v-8k, and TOKEN with your model name, and API key, respectively:

import os
from typing import List, Optional
from llama_index.llms.stepfun import StepFun
from llama_index.core.llms import ChatMessage

llm = StepFun(
    api_key="TOKEN",
    max_tokens=256,
    context_window=4096,
    model="step-1v-8k",
)

Chat Functionality

StepFun supports chat APIs, allowing you to handle conversation-like interactions. Here’s how to use it:

from llama_index.llms.stepfun import StepFun
from llama_index.core.llms import ChatMessage

llm = StepFun(
    api_key="",
    max_tokens=256,
    context_window=4096,
    model="step-1v-8k",
)


message = ChatMessage(role="user", content="Tell me a joke")
resp = llm.chat([message])
print(resp)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llama_index_llms_stepfun-1.1.0.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llama_index_llms_stepfun-1.1.0-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file llama_index_llms_stepfun-1.1.0.tar.gz.

File metadata

File hashes

Hashes for llama_index_llms_stepfun-1.1.0.tar.gz
Algorithm Hash digest
SHA256 43282cc3405aec57473bacb586b7396b39650aab878202fdf2a914baafd4d065
MD5 7c3240a08d8972c9378b3b09eb43b26a
BLAKE2b-256 f78c618d5452b650186ce23730f25613008e20e4db2e0bda8493ab22aa271bbf

See more details on using hashes here.

File details

Details for the file llama_index_llms_stepfun-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_llms_stepfun-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4f7b1992217a7cdfc5e53c37091e9f6e1ddb1d21be8bdf547919895c3e7c3939
MD5 4ffe485ad88115faf02ceade3eba577f
BLAKE2b-256 d0706b035d4324591de1c8255ec207d26a5369e181ba850ff70dc67e3164e6ff

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page