This repository has been archived by the owner on Apr 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Multi-agent shared vector database (#202) * add example * create env variables * add md file * Update pull-request-links.yml * testing action * testing action * testing action * testing action * action works * PR updates * update to shared memory * vectors * Remove reference to `create_index()` for `VectorStoreDriver`s (#205) * remove reference to create_index() * Update image tool documentation for task memory support (#206) * Update ImageLoader interface (#208) * Add example mappings for Amazon OpenSearch index creation (#209) * Add example mappings for Amazon OpenSearch index creation * Removed carryover comment * Refactor header structure, fix a couple headings (#211) * Fix marqo query example (#214) * Fix directory structure to match new layout (#215) * Updated ToS (#213) * Updated Terms of Service Added instructions for generating from .docx with Pandoc * Updated Terms of Service Added instructions for generating from .docx with Pandoc * Switch to rtf format * Fix pandoc errors * More pandoc errors Maybe Pandox was a bad idea * Hack to exclude code snippets from pytest (#216) * Run integration tests on PRs (#217) * Run integration tests on PRs * Fix env vars * Update deps * Update readthedocs build def (#223) * Fix integration tests (#220) * Run integration tests on PRs * Fix env vars * Fix some examples * test code blocks in specific path/file with CODE_PATH env var * update engine tests to define prompt driver * Fix test failures in vector store drivers * Fix task memory example execution * Fix tasks example execution * Update prompt driver * Update env var thing * Add pgvector service container * Wire up pgvector vars * save workflow config * Replicate .csv assets locally * Test workflow updates * Update dependencies * Update workflow * Update spec * Widen test scope to all integration tests * misc and example fixes * Remove dev dependency * wire env var --------- Co-authored-by: Andrew French <andrew@afren.ch> * Add Image Query docs (#219) * Update docs for new config classes (#218) * Update docs for new config classes * Fix links * Revert poetry lock to main * Remove docs gruop * Ignore assets * Update env * Update config * Add back assets * Revert poetry * Revert group * Regerate lock file * Regenerate lockfile * Fixes * Fix tests * Version bump v0.23.0 --------- Co-authored-by: Matt Vallillo <matt@griptape.ai> Co-authored-by: Collin Dutter <collin@griptape.ai> Co-authored-by: cjkindel <cjkindel@users.noreply.github.com>
- Loading branch information
1 parent
f94582a
commit 2c640eb
Showing
48 changed files
with
3,279 additions
and
1,468 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,3 +17,4 @@ jobs: | |
with: | ||
project-slug: ${{ secrets.READTHEDOCS_PROJECT_SLUG }} | ||
single-version: 'false' | ||
project-language: "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
This example shows how to use one `Agent` to load content into `TaskMemory` and get that content from another `Agent` using `TaskMemoryClient`. | ||
|
||
The first `Agent` uses a remote vector store (`MongoDbAtlasVectorStoreDriver` in this example) to handle memory operations. The second `Agent` uses the same instance of `TaskMemory` and the `TaskMemoryClient` with the same `MongoDbAtlasVectorStoreDriver` to get the data. | ||
|
||
The `MongoDbAtlasVectorStoreDriver` assumes that you have a vector index configured where the path to the content is called `vector`, and the number of dimensions set on the index is `1536` (this is a commonly used number of dimensions for embedding models). | ||
|
||
`asker` uses the same instance of `TaskMemory` as `loader` so that `asker` has access to the `namespace_storages` that `loader` has set. | ||
|
||
```python | ||
import os | ||
from griptape.tools import WebScraper, VectorStoreClient, TaskMemoryClient | ||
from griptape.structures import Agent | ||
from griptape.drivers import AzureOpenAiChatPromptDriver, AzureOpenAiEmbeddingDriver, AzureMongoDbVectorStoreDriver | ||
from griptape.engines import VectorQueryEngine, PromptSummaryEngine, CsvExtractionEngine, JsonExtractionEngine | ||
from griptape.memory import TaskMemory | ||
from griptape.artifacts import TextArtifact | ||
from griptape.memory.task.storage import TextArtifactStorage | ||
from griptape.config import StructureConfig, StructureGlobalDriversConfig | ||
|
||
|
||
AZURE_OPENAI_ENDPOINT = os.getenv("AZURE_OPENAI_API_BASE") | ||
|
||
MONGODB_HOST = os.getenv("MONGODB_HOST") | ||
MONGODB_USERNAME = os.getenv("MONGODB_USERNAME") | ||
MONGODB_PASSWORD = os.getenv("MONGODB_PASSWORD") | ||
MONGODB_DATABASE_NAME = os.getenv("MONGODB_DATABASE_NAME") | ||
MONGODB_COLLECTION_NAME = os.getenv("MONGODB_COLLECTION_NAME") | ||
MONGODB_INDEX_NAME = os.getenv("MONGODB_INDEX_NAME") | ||
MONGODB_VECTOR_PATH = os.getenv("MONGODB_VECTOR_PATH") | ||
MONGODB_CONNECTION_STRING = f"mongodb+srv://{MONGODB_USERNAME}:{MONGODB_PASSWORD}@{MONGODB_HOST}/{MONGODB_DATABASE_NAME}?tls=true&authMechanism=SCRAM-SHA-256&retrywrites=false&maxIdleTimeMS=120000" | ||
|
||
|
||
azure_embedding_driver = AzureOpenAiEmbeddingDriver( | ||
model='text-embedding-ada-002', | ||
azure_endpoint=AZURE_OPENAI_ENDPOINT, | ||
azure_deployment='text-embedding-ada-002' | ||
) | ||
|
||
azure_prompt_driver = AzureOpenAiChatPromptDriver( | ||
model='gpt-4', | ||
azure_endpoint=AZURE_OPENAI_ENDPOINT, | ||
azure_deployment='gpt-4' | ||
) | ||
|
||
mongo_driver = AzureMongoDbVectorStoreDriver( | ||
connection_string=MONGODB_CONNECTION_STRING, | ||
database_name=MONGODB_DATABASE_NAME, | ||
collection_name=MONGODB_COLLECTION_NAME, | ||
embedding_driver=azure_embedding_driver, | ||
index_name=MONGODB_INDEX_NAME, | ||
vector_path=MONGODB_VECTOR_PATH | ||
) | ||
|
||
loader = Agent( | ||
tools=[ | ||
WebScraper() | ||
], | ||
config=StructureConfig( | ||
global_drivers=StructureGlobalDriversConfig( | ||
prompt_driver=azure_prompt_driver, | ||
vector_store_driver=mongo_driver, | ||
embedding_driver=azure_embedding_driver | ||
) | ||
), | ||
) | ||
asker = Agent( | ||
tools=[ | ||
TaskMemoryClient(off_prompt=False), | ||
], | ||
meta_memory=loader.meta_memory, | ||
task_memory=loader.task_memory, | ||
) | ||
|
||
if __name__ == "__main__": | ||
loader.run("Load https://medium.com/enterprise-rag/a-first-intro-to-complex-rag-retrieval-augmented-generation-a8624d70090f") | ||
asker.run("why is retrieval augmented generation useful?") | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.