Documentation Index
Fetch the complete documentation index at: https://docs.aihubmix.com/llms.txt
Use this file to discover all available pages before exploring further.
Am einfachsten ist es, die Umgebungsvariablen direkt wie unten gezeigt zu setzen
Download-Adresse: https://www.langchain.com/
API_SECRET_KEY = "sk-pvMtoVO******66249058b93C766F2D70167"
BASE_URL = "https://aihubmix.com/v1"; #Base URL for aihubmix
os.environ["OPENAI_API_KEY"] = API_SECRET_KEY
os.environ["OPENAI_BASE_URL"] = BASE_URL
Hinweis: Stellen Sie sicher, dass am Ende von openai_api_base /v1 angehängt wird.
from langchain.chat_models import ChatOpenAI
llm = ChatOpenAI(
openai_api_base="https://aihubmix.com/v1", # Note, add /v1 at the end
openai_api_key="sk-3133f******fee269b71d",
)
res = llm.predict("hello")
print(res)
Beispielcode für die Verwendung eines LLM zur Vorhersage
Der Kern liegt im Setzen des Keys und der URL
Mögliche Methoden:
- Setzen über Umgebungsvariablen
- Übergabe als Variablen
- Manuelles Setzen der Umgebungsvariablen
import os
import requests
import time
import json
import time
from langchain.llms import OpenAI
API_SECRET_KEY = "your key from aihubmix";
BASE_URL = "https://aihubmix.com/v1"; #Base URL for aihubmix
os.environ["OPENAI_API_KEY"] = API_SECRET_KEY
os.environ["OPENAI_API_BASE"] = BASE_URL
def text():
llm = OpenAI(temperature=0.9)
text = "What would be a good company name for a company that makes colorful socks?"
print(llm(text))
if __name__ == '__main__':
text();
Nach der Ausführung sehen Sie die Rückgabe:
Zuletzt aktualisiert: 2026-06-01