but this code is giving the error
config = {
"cache": {
"mode": "semantic",
},
"retry" : {
"attempts": 3
},
}
portkey_headers = createHeaders(api_key= os.getenv("PORTKEY_API_KEY"),
provider="openai",
metadata={"_user": "m"},
config=config
)
def init_openai_chat(temperature):
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
return ChatOpenAI(
openai_api_key=OPENAI_API_KEY, streaming=True, temperature=temperature, model='gpt-4o',
base_url=PORTKEY_GATEWAY_URL, default_headers=portkey_headers
)
Error:
total_tokens = oai_token_usage.get("total_tokens", input_tokens + output_tokens)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'
@sega any solutions for this?