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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file llama_index_llms_stepfun-1.0.1.tar.gz.
File metadata
- Download URL: llama_index_llms_stepfun-1.0.1.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4325a661d7913e3b47d4b2f8fd9e7aadf81ca7b1fd9f23726173e2f005c69a3c
|
|
| MD5 |
46d7d2fb0c0377326b76cb0e33ac069c
|
|
| BLAKE2b-256 |
233b1fca239473a69cc6960fe449758e350cf951d8e29b1a5ae5df13609bcf4d
|
File details
Details for the file llama_index_llms_stepfun-1.0.1-py3-none-any.whl.
File metadata
- Download URL: llama_index_llms_stepfun-1.0.1-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b49ee6b07a647774fae8c72b2d526c896e85c461a28f44d03252cee014a76ef9
|
|
| MD5 |
7d46498d00381b7e5662ebe10df141b8
|
|
| BLAKE2b-256 |
41870fd671c6f1889cae4ffa861b1a6afc4a8d0242733a179948dd40394f576b
|