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

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for llama_index_llms_stepfun-1.0.1.tar.gz
Algorithm Hash digest
SHA256 4325a661d7913e3b47d4b2f8fd9e7aadf81ca7b1fd9f23726173e2f005c69a3c
MD5 46d7d2fb0c0377326b76cb0e33ac069c
BLAKE2b-256 233b1fca239473a69cc6960fe449758e350cf951d8e29b1a5ae5df13609bcf4d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llama_index_llms_stepfun-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b49ee6b07a647774fae8c72b2d526c896e85c461a28f44d03252cee014a76ef9
MD5 7d46498d00381b7e5662ebe10df141b8
BLAKE2b-256 41870fd671c6f1889cae4ffa861b1a6afc4a8d0242733a179948dd40394f576b

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