You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from sglang import function, system, user, assistant, gen, set_default_backend, OpenAI
@function
def multi_turn_question(s, question_1, question_2):
s += system("You are a helpful assistant.")
s += user(question_1)
s += assistant(gen("answer_1", max_tokens=256))
s += user(question_2)
s += assistant(gen("answer_2", max_tokens=256))
set_default_backend(OpenAI("gpt-3.5-turbo"))
state = multi_turn_question.run(
question_1="What is the capital of the United States?",
question_2="List two local attractions.",
)
for m in state.messages():
print(m["role"], ":", m["content"])
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
[<ipython-input-3-ac9af75fa374>](https://localhost:8080/#) in <cell line: 11>()
9 s += assistant(gen("answer_2", max_tokens=256))
10
---> 11 set_default_backend(OpenAI("gpt-3.5-turbo"))
12
13 state = multi_turn_question.run(
[/usr/local/lib/python3.10/dist-packages/sglang/backend/openai.py](https://localhost:8080/#) in __init__(self, model_name, *args, **kwargs)
52 def __init__(self, model_name, *args, **kwargs):
53 super().__init__()
---> 54 self.client = openai.OpenAI(*args, **kwargs)
55
56 if isinstance(openai, Exception):
AttributeError: 'ModuleNotFoundError' object has no attribute 'OpenAI'
Activity
merrymercy commentedon Jan 21, 2024
please install this openai package https://github.com/openai/openai-python
Merge pull request sgl-project#65 from mingfeima/zlwang/prompt2
misc: Fix doc naming and use flexible plot in cli (sgl-project#65)
feat: update pyproject (sgl-project#65)
weights_region: resident arm loads outside the memory-saver MemPool (…