Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ResponseRagStage and PromptResponseRagModule updates #1056

Merged
merged 15 commits into from
Aug 12, 2024

Conversation

vasinov
Copy link
Member

@vasinov vasinov commented Aug 9, 2024

Describe your changes

  • BREAKING: RagContext.output was changed to RagContext.outputs to support multiple outputs. All relevant RAG modules we adjusted accordingly.
  • BREAKING: Removed before and after response modules from ResponseRagStage.
  • BREAKING: Moved ruleset and metadata ingestion from standalone modules to PromptResponseRagModule.
  • Unique name generation for all RagEngine modules.

📚 Documentation preview 📚: https://griptape--1056.org.readthedocs.build//1056/

vasinov added 9 commits August 8, 2024 15:24
# Conflicts:
#	docs/examples/query-webpage-astra-db.md
#	docs/examples/talk-to-a-pdf.md
#	docs/examples/talk-to-a-webpage.md
#	docs/griptape-framework/engines/rag-engines.md
#	docs/griptape-framework/structures/task-memory.md
#	docs/griptape-framework/structures/tasks.md
#	docs/griptape-tools/official-tools/rag-client.md
@vasinov vasinov requested a review from collindutter August 9, 2024 19:21
Copy link

codecov bot commented Aug 9, 2024

CHANGELOG.md Outdated
Comment on lines 22 to 23
**BREAKING**: Removed before and after response modules from `ResponseRagStage`.
**BREAKING**: Moved ruleset and metadata ingestion from standalone modules to `PromptResponseRagModule`.
Copy link
Member

Choose a reason for hiding this comment

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

Missing hypens

prompt_driver: BasePromptDriver = field()
answer_token_offset: int = field(default=400)
rulesets: list[Ruleset] = field(factory=list)
Copy link
Member

Choose a reason for hiding this comment

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

Should implement RuleMixin instead of defining itself.

params: dict[str, Any] = {"text_chunks": [c.to_text() for c in artifacts]}

if len(self.rulesets) > 0:
params["rulesets"] = J2("rulesets/rulesets.j2").render(rulesets=self.rulesets)
Copy link
Member

Choose a reason for hiding this comment

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

After implementing RuleMixin, replace self.rulesets with self.all_rulesets.

Comment on lines 12 to 16
artifacts = WebLoader(max_tokens=500).load("https://www.griptape.ai")
if isinstance(artifacts, ErrorArtifact):
raise ValueError(artifacts.value)

vector_store.upsert_text_artifacts({"griptape": artifacts})
vector_store.upsert_text_artifacts(
{
"griptape": WebLoader(max_tokens=500).load("https://www.griptape.ai"),
}
)
Copy link
Member

@collindutter collindutter Aug 9, 2024

Choose a reason for hiding this comment

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

Does this pass type checks?

Edit: it probably will not: #1057

Comment on lines +18 to +20
name: str = field(
default=Factory(lambda self: f"{self.__class__.__name__}-{uuid.uuid4().hex}", takes_self=True), kw_only=True
)
Copy link
Member

Choose a reason for hiding this comment

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

What does name uniqueness get us?

Copy link
Member Author

Choose a reason for hiding this comment

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

Much easier to add multiple modules of the same type without having to explicitly define names. May be that's something we add to tools as well?

Comment on lines 24 to 29
def modules(self) -> list[BaseRagModule]:
ms = []

ms.extend(self.before_response_modules)
ms.extend(self.after_response_modules)

if self.response_module is not None:
ms.append(self.response_module)
ms.extend(self.response_modules)

return ms
Copy link
Member

Choose a reason for hiding this comment

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

Do we still need this property?

Copy link
Member Author

Choose a reason for hiding this comment

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

We do because we test for module name uniqueness by using this property.

collindutter
collindutter previously approved these changes Aug 12, 2024
@vasinov vasinov merged commit f77d8e8 into dev Aug 12, 2024
12 checks passed
@vasinov vasinov deleted the feature/refactor-rag-responses branch August 12, 2024 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants