Spaces:
Runtime error
Runtime error
File size: 922 Bytes
a2ee974 e619c67 a2ee974 f65d23a b5eb0e7 a2ee974 f65d23a 3d41135 a6bb63b a2ee974 f65d23a b149245 3a80ab5 a2ee974 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# Created by Leandro Carneiro at 19/01/2024
# Description:
# ------------------------------------------------
from langchain_openai import ChatOpenAI
import os
def invoke_llm(context, task):
prompt = f"""You are an assistant of a newspaper.
Execute the task just based on the given context.
The task is delimited by <> and the context is delimited by <>.
Write in a formal language and in portuguese language.
Execute the task just based on the given context.
Your task is: <{task}>
The context is: <{context}>
Answer here:
"""
llm=ChatOpenAI(model_name="gpt-3.5-turbo",
temperature=0.3,
openai_api_key=os.environ['OPENAI_KEY'],
max_tokens=1000)
result = llm.invoke(prompt)
return result.content
|