Find answers from the community

Updated 3 months ago

Is there a way to log all the prompts

Is there a way to log all the prompts that get sent to openai api? The logging settings from the tutorial aren't making a difference
1
L
v
V
5 comments
Try using the llama logger ๐Ÿ’ช
Plain Text
from llama_index.logger import LlamaLogger

llama_logger = LlamaLogger()
service_context = ServiceContext.from_defaults(..., llama_logger=llama_logger)
....
response = index.query("my query")
print(llama_logger.get_logs())  # prints all logs, which basically includes all LLM inputs and responses
llama_logger.reset() 
Another way is using nohup e.g.

nohup python app.py &>logs.txt
it's just what i need๐Ÿ‘
thanks a lot for that! I have to refactor a lot of code because of the newly added service context but seems to work pretty well
Add a reply
Sign up and join the conversation on Discord