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-0.3.2.tar.gz (2.4 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-0.3.2-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: llama_index_llms_stepfun-0.3.2.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.12.1 Linux/6.5.0-1025-azure

File hashes

Hashes for llama_index_llms_stepfun-0.3.2.tar.gz
Algorithm Hash digest
SHA256 f097c05d791245b13e8c19bfa091256198ab1f6cc4e26b894eeff0fa1edbca13
MD5 bee1e5a327715f234c94bc4ae3ecc814
BLAKE2b-256 7d43253b8772c5fc6d386f50c0043a07be61adfbac4485dc46670217fdc97736

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llama_index_llms_stepfun-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 982add7c35cb1c6d3af78660fb8cf22cb75d911e1a52db509ace3e8ed221fbed
MD5 d78ff99325d19ad69604c2ca09d68846
BLAKE2b-256 eb94f2717aca34d2c70515eb8d842c9452bcb764952b233bf1dc97156f013e03

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