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.1.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.1-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for llama_index_llms_stepfun-1.1.1.tar.gz
Algorithm Hash digest
SHA256 80e7a1321cb73100dd74da46951c2dfc0b2600b38372a68c1afbe65a9a69ebdb
MD5 8eb99549018787b0f96af5b76863ef22
BLAKE2b-256 157fef057d27b602354d456192436a73c75aa8cc03b49166028428324b4651a1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llama_index_llms_stepfun-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 310d56179d835c195397f0a26bd2797c016984291a4a269352b0a19b88132832
MD5 2c25a804082cef1a5025f9a22838f1cf
BLAKE2b-256 0e7b938c25b660259217fe9b2649e504bb5c04ba900671caaf9f586b30ea2e8a

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