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

Uploaded Python 3

File details

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

File metadata

  • Download URL: llama_index_llms_stepfun-0.1.0.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.3 Linux/6.8.0-1017-azure

File hashes

Hashes for llama_index_llms_stepfun-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6c15a83cbbe2bbe8ab0bf5b5902b2cb71052e57abdf379465b04ceaf06fddbf7
MD5 1c321239f8c62194160330e1837f8c7c
BLAKE2b-256 f295bcb17c145019c062ee51751323db16e3480b764fa69cc7f4bd687d22caa0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llama_index_llms_stepfun-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1c02f643113afb6b0b45ce46bd18bf6ccae4b42e896bc1405b301450d6553cb8
MD5 b114279d47c2e6c0829c35a85a79e194
BLAKE2b-256 bbf2ef10dd1214c6449da704ab0d88e269bc6f20dd07824166f179a21b92213d

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