You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/macaron/ai/README.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,13 +5,13 @@ This module provides the foundation for interacting with Large Language Models (
5
5
## Module Components
6
6
7
7
-**ai_client.py**
8
-
Defines the abstract [`AIClient`](./ai_client.py) class. This class handles the initialization of LLM configuration from the defaults and serves as the base for all specific AI client implementations.
8
+
Defines the abstract [`AIClient`](./clients/base.py) class. This class handles the initialization of LLM configuration from the defaults and serves as the base for all specific AI client implementations.
9
9
10
10
-**openai_client.py**
11
-
Implements the [`OpenAiClient`](./openai_client.py) class, a concrete subclass of [`AIClient`](./ai_client.py). This client interacts with OpenAI-like APIs by sending requests using HTTP and processing the responses. It also validates and structures responses using the tools provided.
11
+
Implements the [`OpenAiClient`](./clients/openai_client.py) class, a concrete subclass of [`AIClient`](./ai_client.py). This client interacts with OpenAI-like APIs by sending requests using HTTP and processing the responses. It also validates and structures responses using the tools provided.
12
12
13
13
-**ai_factory.py**
14
-
Contains the [`AIClientFactory`](./ai_factory.py) class, which is responsible for reading provider configuration from the defaults and creating the correct AI client instance.
14
+
Contains the [`AIClientFactory`](./clients/base.py) class, which is responsible for reading provider configuration from the defaults and creating the correct AI client instance.
15
15
16
16
-**ai_tools.py**
17
17
Offers utility functions such as `structure_response` to assist with parsing and validating the JSON response returned by an LLM. These functions ensure that responses conform to a given Pydantic model for easier downstream processing.
@@ -22,11 +22,11 @@ This module provides the foundation for interacting with Large Language Models (
22
22
The module reads the LLM configuration from the application defaults (using the `defaults` module). Make sure that the `llm` section in your configuration includes valid settings such as `enabled`, `api_key`, `api_endpoint`, `model`, and `context_window`.
23
23
24
24
2.**Creating a Client:**
25
-
Use the [`AIClientFactory`](./ai_factory.py) to create an AI client instance. The factory checks the configured provider and returns a client (e.g., an instance of [`OpenAiClient`](./openai_client.py)) that can be used to invoke the LLM.
25
+
Use the [`AIClientFactory`](./clients/ai_factory.py) to create an AI client instance. The factory checks the configured provider and returns a client (e.g., an instance of [`OpenAiClient`](./clients/openai_client.py)) that can be used to invoke the LLM.
26
26
27
27
Example:
28
28
```py
29
-
from macaron.ai.ai_factory import AIClientFactory
29
+
from macaron.ai.clients.ai_factory import AIClientFactory
30
30
31
31
factory = AIClientFactory()
32
32
client = factory.create_client(system_prompt="You are a helpful assistant.")
@@ -45,6 +45,6 @@ This module provides the foundation for interacting with Large Language Models (
45
45
## Extensibility
46
46
47
47
The design of the AI module is provider-agnostic. To add support for additional LLM providers:
48
-
- Implement a new client by subclassing [`AIClient`](./ai_client.py).
49
-
- Add the new client to the [`PROVIDER_MAPPING`](./ai_factory.py).
48
+
- Implement a new client by subclassing [`AIClient`](./clients/base.py).
49
+
- Add the new client to the [`PROVIDER_MAPPING`](./clients/ai_factory.py).
0 commit comments