Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

context engine docstring #130

Merged
merged 3 commits into from
Nov 1, 2023
Merged

context engine docstring #130

merged 3 commits into from
Nov 1, 2023

Conversation

acatav
Copy link
Contributor

@acatav acatav commented Oct 31, 2023

context engine docstring

Comment on lines +28 to +34
ContextEngine is responsible for providing context to the LLM, given a set of search queries.

Once called with a set of queries, the ContextEngine will go through the following steps:
1. Query the knowledge base for relevant documents
2. Build a context from the documents retrieved that can be injected into the LLM prompt

The context engine considers token budgeting when building the context, and tries to maximize the amount of relevant information that can be provided to the LLM within the token budget.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it! 😍

Copy link
Contributor

@igiloh-pinecone igiloh-pinecone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
See two minor suggestions

src/canopy/context_engine/context_engine.py Outdated Show resolved Hide resolved
The context engine considers token budgeting when building the context, and tries to maximize the amount of relevant information that can be provided to the LLM within the token budget.

To create a context engine, you must provide a knowledge base and optionally a context builder.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should also mention that the returned Context object could be either structured or unstructured, but it always supports a .to_text() method dumping it as formatted text?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO it's too deep for putting in this layer of docstrings, it's something to look at in the context builder I think because it relevant only once you want to costumes it

@acatav acatav enabled auto-merge November 1, 2023 13:28
@acatav acatav added this pull request to the merge queue Nov 1, 2023
Merged via the queue into dev with commit 00c7827 Nov 1, 2023
10 checks passed
@acatav acatav deleted the context-engine-docstrings branch November 1, 2023 13:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants