Skip to content

Add this to readme #4

@mail2harishemail

Description

@mail2harishemail

new

from openai import OpenAI

client = OpenAI(
api_key="irrelevant", # this must set
base_url = "https://api.kastan.ai/v1" # this must set
)
def custom_completion(prompt):

completion = client.completions.create(
    
    model="llama-2-7b",
    prompt=prompt,
    max_tokens=200,
    temperature=0.7,
    stream=True)

# ⚡️⚡️ streaming
for token in completion:
    print(token.choices[0].text, end='')

custom_completion("what is the capital of france?")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions