Skip to content

Commit

Permalink
Update changelog/docs
Browse files Browse the repository at this point in the history
  • Loading branch information
collindutter committed Oct 9, 2024
1 parent f0292bc commit ffc1207
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 0 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased
### Added
- `LoggingConfig.handlers` for configuring logging handlers.
- `LoggingConfig.handlers_formatter` for configuring a formatter for all handlers.
- `LoggingConfig.propagate` for configuring whether log messages should be propagated to parent loggers.
- `LoggingConfig.level` for configuring the logging level.
- `griptape.configs.logging.JsonFormatter` for formatting logs as JSON.
- Request/response debug logging to all Prompt Drivers.

### Changed
- `_DefaultsConfig.logging_config` and `Defaults.drivers_config` are now lazily instantiated.

## [0.33.0] - 2024-10-09

Expand Down
74 changes: 74 additions & 0 deletions docs/griptape-framework/structures/configs.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,80 @@ Griptape provides a predefined [LoggingConfig](../../reference/griptape/configs/
--8<-- "docs/griptape-framework/structures/src/logging_config.py"
```

#### Debug Logs

Here is an example of how to enable debug logs for the framework:

```python
import logging

from griptape.configs import Defaults
from griptape.configs.defaults_config import LoggingConfig
from griptape.configs.logging import JsonFormatter
from griptape.drivers import OpenAiChatPromptDriver
from griptape.structures import Agent
from griptape.tools import CalculatorTool

Defaults.logging_config = LoggingConfig(handlers_formatter=JsonFormatter(), level=logging.DEBUG)

agent = Agent(tools=[CalculatorTool()])

agent.run("What is 4 + 4?")
```

```
[10/09/24 15:30:04] INFO PromptTask 75ef1747a5824bc8ac838f3081aeb57d
Input: Hello world!
DEBUG {
"model": "gpt-4o",
"temperature": 0.1,
"user": "",
"seed": null,
"messages": [
{
"role": "user",
"content": "Hello world!"
}
]
}
[10/09/24 15:30:05] DEBUG {
"id": "chatcmpl-AGZTwg4T4YikR2KjF3AMIRxlIfcKa",
"choices": [
{
"finish_reason": "stop",
"index": 0,
"logprobs": null,
"message": {
"content": "Hello! How can I assist you today?",
"refusal": null,
"role": "assistant",
"function_call": null,
"tool_calls": null
}
}
],
"created": 1728513004,
"model": "gpt-4o-2024-08-06",
"object": "chat.completion",
"service_tier": null,
"system_fingerprint": "fp_2f406b9113",
"usage": {
"completion_tokens": 9,
"prompt_tokens": 10,
"total_tokens": 19,
"prompt_tokens_details": {
"cached_tokens": 0
},
"completion_tokens_details": {
"reasoning_tokens": 0
}
}
}
INFO PromptTask 75ef1747a5824bc8ac838f3081aeb57d
Output: Hello! How can I assist you today?
```

### Loading/Saving Configs

```python
Expand Down

0 comments on commit ffc1207

Please sign in to comment.