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

Commit

Permalink
Release/v0.22.0 (#194)
Browse files Browse the repository at this point in the history
* Install griptape from dev

* Install all extras

* Add extras

* Update again

* Fix argument name

* Parameterize snippts

* Ignore test, update id

* Don't fail fast

* Fix examples

* Fixes

* Fix env variables, imports

* Fix variable names

* Ignore running sagemaker examples

* Rename utils

* Remove mktestdocs
  • Loading branch information
collindutter authored Jan 11, 2024
1 parent f96f8bd commit c5bf686
Show file tree
Hide file tree
Showing 14 changed files with 2,213 additions and 768 deletions.
6 changes: 1 addition & 5 deletions .github/actions/init-environment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,9 @@ runs:

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root --with docs --with test
run: poetry install --no-interaction --no-root --with docs --with test --all-extras
shell: bash

- name: Install project
run: poetry install --no-interaction --with docs --with test
shell: bash

- name: Activate venv
run: |
source .venv/bin/activate
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,13 @@ jobs:
GOOGLE_OWNER_EMAIL: ${{ secrets.INTEG_GOOGLE_OWNER_EMAIL }}
LEONARDO_API_KEY: ${{ secrets.INTEG_LEONARDO_API_KEY }}
LEONARDO_MODEL_ID: ${{ secrets.INTEG_LEONARDO_MODEL_ID }}
SAGEMAKER_TENSORFLOW_HUB_MODEL: ${{ secrets.INTEG_SAGEMAKER_TENSORFLOW_HUB_MODEL }}
SAGEMAKER_HUGGINGFACE_MODEL: ${{ secrets.INTEG_SAGEMAKER_HUGGINGFACE_MODEL }}

steps:
- name: Checkout actions
uses: actions/checkout@v3
- name: Init environment
uses: ./.github/actions/init-environment
- name: Run integration tests
run: pytest -xvs tests/integration
run: pytest -vs tests/integration
20 changes: 10 additions & 10 deletions docs/griptape-framework/data/embedding-drivers.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ driver = HuggingFaceHubEmbeddingDriver(
),
)

results = driver.embed_string("Hello world!")
embeddings = driver.embed_string("Hello world!")

# display the first 3 embeddings
print(embeddings[:3])
Expand All @@ -94,32 +94,32 @@ The [AmazonSageMakerEmbeddingDriver](../../reference/griptape/drivers/embedding/
This driver requires the `drivers-embedding-amazon-sagemaker` [extra](../index.md#extras).

##### TensorFlow Hub Models
```python
```python ignore
import os
from griptape.drivers import HuggingFaceHubEmbeddingDriver
from griptape.drivers import AmazonSageMakerEmbeddingDriver, SageMakerTensorFlowHubEmbeddingModelDriver

embedding_driver=AmazonSageMakerEmbeddingDriver(
driver = AmazonSageMakerEmbeddingDriver(
model=os.environ["SAGEMAKER_TENSORFLOW_HUB_MODEL"],
embedding_model_driver=SageMakerTensorFlowHubEmbeddingModelDriver(),
)

results = driver.embed_string("Hello world!")
embeddings = driver.embed_string("Hello world!")

# display the first 3 embeddings
print(embeddings[:3])
```

##### HuggingFace Models
```python
```python ignore
import os
from griptape.drivers import HuggingFaceHubEmbeddingDriver
from griptape.drivers import AmazonSageMakerEmbeddingDriver, SageMakerHuggingFaceEmbeddingModelDriver

embedding_driver=AmazonSageMakerEmbeddingDriver(
driver = AmazonSageMakerEmbeddingDriver(
model=os.environ["SAGEMAKER_HUGGINGFACE_MODEL"],
embedding_model_driver=SageMakerTensorFlowHubEmbeddingModelDriver(),
embedding_model_driver=SageMakerHuggingFaceEmbeddingModelDriver(),
)

results = driver.embed_string("Hello world!")
embeddings = driver.embed_string("Hello world!")

# display the first 3 embeddings
print(embeddings[:3])
Expand Down
6 changes: 3 additions & 3 deletions docs/griptape-framework/structures/prompt-drivers.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ agent = Agent(
prompt_driver=OpenAiChatPromptDriver(
api_key=os.environ["OPENAI_API_KEY"],
temperature=0.1,
model="gpt-3.5-turbo-16k",
model="gpt-3.5-turbo",
response_format="json_object",
seed=42,
),
Expand Down Expand Up @@ -271,7 +271,7 @@ agent.run("Hello Girafatron, what is your favorite animal?")

The [HuggingFaceHubPromptDriver](#hugging-face-hub) also supports [Text Generation Interface](https://huggingface.co/docs/text-generation-inference/basic_tutorials/consuming_tgi#inference-client) for running models locally. To use Text Generation Interface, just set `model` to a TGI endpoint.

```python
```python ignore
import os
from griptape.structures import Agent
from griptape.drivers import HuggingFaceHubPromptDriver
Expand Down Expand Up @@ -370,7 +370,7 @@ from griptape.drivers import (
AmazonSageMakerPromptDriver,
SageMakerLlamaPromptModelDriver,
)
from griptape.structures.structure import Rule
from griptape.rules import Rule

agent = Agent(
prompt_driver=AmazonSageMakerPromptDriver(
Expand Down
8 changes: 4 additions & 4 deletions docs/griptape-framework/structures/rulesets.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ pipeline = Pipeline(
)

pipeline.add_tasks(
PromptTask(input_template="Respond to this user's question: {{ args[0] }}"),
PromptTask(input="Respond to this user's question: {{ args[0] }}"),
PromptTask(
input_template="Extract keywords from this response: {{ parent_output }}"
input="Extract keywords from this response: {{ parent_output }}"
),
)

Expand Down Expand Up @@ -114,7 +114,7 @@ pipeline = Pipeline()

pipeline.add_tasks(
PromptTask(
input_template="Respond to the following prompt: {{ args[0] }}",
input="Respond to the following prompt: {{ args[0] }}",
rulesets=[
Ruleset(
name="Emojis",
Expand All @@ -125,7 +125,7 @@ pipeline.add_tasks(
]
),
PromptTask(
input_template="Determine the sentiment of the following text: {{ parent_output }}",
input="Determine the sentiment of the following text: {{ parent_output }}",
rulesets=[
Ruleset(
name="Diacritic",
Expand Down
4 changes: 2 additions & 2 deletions docs/griptape-framework/structures/tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ A [Task](../../reference/griptape/tasks/index.md) is a purpose-built abstraction


## Context
Tasks that take input have a field [input_template](../../reference/griptape/tasks/base_text_input_task.md#griptape.tasks.base_text_input_task.BaseTextInputTask.input_template) which lets you define the Task objective.
Within the [input_template](../../reference/griptape/tasks/base_text_input_task.md#griptape.tasks.base_text_input_task.BaseTextInputTask.input_template), you can access the following [context](../../reference/griptape/structures/structure.md#griptape.structures.structure.Structure.context) variables:
Tasks that take input have a field [input](../../reference/griptape/tasks/base_text_input_task.md#griptape.tasks.base_text_input_task.BaseTextInputTask.input) which lets you define the Task objective.
Within the [input](../../reference/griptape/tasks/base_text_input_task.md#griptape.tasks.base_text_input_task.BaseTextInputTask.input), you can access the following [context](../../reference/griptape/structures/structure.md#griptape.structures.structure.Structure.context) variables:

* `args`: an array of arguments passed to the `.run()` method.
* `structure`: the structure that the task belongs to.
Expand Down
4 changes: 2 additions & 2 deletions docs/griptape-tools/custom-tools/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ To add Python dependencies for your tool, add a `requirements.txt` file. The too

Next, create a `tool.py` file with the following code:

```python
```python ignore
import random
from griptape.artifacts import TextArtifact
from griptape.tools import BaseTool
Expand Down Expand Up @@ -58,7 +58,7 @@ class RandomNumberGenerator(BaseTool):

Finally, let's test our tool:

```python
```python ignore
from griptape.structures import Agent
from rng_tool.tool import RandomNumberGenerator
Expand Down
4 changes: 2 additions & 2 deletions docs/griptape-tools/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Tools give the LLM abilities to invoke outside APIs, reference data sets, and ge

Griptape tools are special Python classes that LLMs can use to accomplish specific goals. Here is an example custom tool for generating a random number:

```python
```python ignore
import random
from griptape.artifacts import TextArtifact
from griptape.tools import BaseTool
Expand Down Expand Up @@ -30,7 +30,7 @@ A tool can have many "activities" as denoted by the `@activity` decorator. Each

Output artifacts from all tool activities (except for `InfoArtifact` and `ErrorArtifact`) go to short-term `TaskMemory`. To disable that behavior set the `off_prompt` tool parameter to `False`:

```python
```python ignore
RandomNumberGenerator(off_prompt=False)
```

Expand Down
Loading

0 comments on commit c5bf686

Please sign in to comment.