Spaces:
Runtime error
Runtime error
leandrocarneiro
commited on
Update llm.py
Browse files
llm.py
CHANGED
@@ -2,6 +2,7 @@
|
|
2 |
# Description:
|
3 |
# ------------------------------------------------
|
4 |
from langchain_openai import ChatOpenAI
|
|
|
5 |
|
6 |
def invoke_llm(context, task):
|
7 |
prompt = f"""You are an assistant of a newspaper.
|
@@ -15,7 +16,7 @@ def invoke_llm(context, task):
|
|
15 |
|
16 |
llm=ChatOpenAI(model_name="gpt-3.5-turbo",
|
17 |
temperature=0,
|
18 |
-
openai_api_key=OPENAI_KEY,
|
19 |
max_tokens=1000)
|
20 |
result = llm.invoke(prompt)
|
21 |
return result.content
|
|
|
2 |
# Description:
|
3 |
# ------------------------------------------------
|
4 |
from langchain_openai import ChatOpenAI
|
5 |
+
import os
|
6 |
|
7 |
def invoke_llm(context, task):
|
8 |
prompt = f"""You are an assistant of a newspaper.
|
|
|
16 |
|
17 |
llm=ChatOpenAI(model_name="gpt-3.5-turbo",
|
18 |
temperature=0,
|
19 |
+
openai_api_key=os.getenv('OPENAI_KEY'),
|
20 |
max_tokens=1000)
|
21 |
result = llm.invoke(prompt)
|
22 |
return result.content
|