Skip to content

Commit

Permalink
using basic data models
Browse files Browse the repository at this point in the history
  • Loading branch information
Vinicius Vaz committed Oct 24, 2023
1 parent e95390e commit ee46092
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 19 deletions.
2 changes: 1 addition & 1 deletion config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ REPOSITORY_LABEL = "OpenAI Domino Pieces"

# The version of this Pieces release
# Attention: changing this will create a new release
VERSION = "0.4.0"
VERSION = "0.4.1"
9 changes: 9 additions & 0 deletions dry_run_results/display_result.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

## Generated prompt:
As the divers descend into the depths of the ocean, they are greeted by a surrealistic underwater city, bathed in the ethereal glow of bioluminescent creatures. The ancient structures rise like coral formations, adorned with intricate, mysterious symbols that seem to whisper forgotten tales. In this mesmerizing realm, the explorers uncover evidence of an advanced civilization lost to time. The image you create should capture the awe-inspiring beauty of this underwater metropolis, blending vibrant colors and dreamlike imagery. Let the surrealistic oceanic exploration art style bring to life the secrets and wonders that lie beneath the waves.

## Args
**context**: Explorers dive into a mesmerizing underwater city, discovering ancient secrets, mysterious symbols, and evidence of an advanced civilization.
**model**: gpt-3.5-turbo
**temperature**: 0.7
**completion_max_tokens**: 350
1 change: 1 addition & 0 deletions dry_run_results/generated_prompt.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
As the divers descend into the depths of the ocean, they are greeted by a surrealistic underwater city, bathed in the ethereal glow of bioluminescent creatures. The ancient structures rise like coral formations, adorned with intricate, mysterious symbols that seem to whisper forgotten tales. In this mesmerizing realm, the explorers uncover evidence of an advanced civilization lost to time. The image you create should capture the awe-inspiring beauty of this underwater metropolis, blending vibrant colors and dreamlike imagery. Let the surrealistic oceanic exploration art style bring to life the secrets and wonders that lie beneath the waves.
6 changes: 3 additions & 3 deletions pieces/AudioTranscriptionPiece/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from pydantic import BaseModel, Field, FilePath
from pydantic import BaseModel, Field
from enum import Enum
from typing import Union

Expand All @@ -16,7 +16,7 @@ class InputModel(BaseModel):
"""
AudioTranscriptPiece input model
"""
audio_file_path: FilePath = Field(
audio_file_path: str = Field(
...,
description='The path to the audio file to process.',
)
Expand All @@ -43,7 +43,7 @@ class OutputModel(BaseModel):
default=None,
description="The result transcription text as a string."
)
file_path_transcription_result: FilePath = Field(
file_path_transcription_result: str = Field(
default=None,
description="The result transcription text as a file path."
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import pytest
from domino.testing import piece_dry_run
from pathlib import PosixPath
from pydantic import FilePath
import os


def run_piece(
audio_file_path: FilePath,
audio_file_path: str,
output_type: str,
temperature: float = 0.1,
):
Expand Down
4 changes: 2 additions & 2 deletions pieces/ImageGeneratorPiece/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from pydantic import BaseModel, Field, FilePath
from pydantic import BaseModel, Field
from enum import Enum


Expand Down Expand Up @@ -59,7 +59,7 @@ class OutputModel(BaseModel):
default=None,
description="The generated image as string",
)
output_file_path: FilePath = Field(
output_file_path: str = Field(
default=None,
description="Path to the generated image",
)
Expand Down
2 changes: 1 addition & 1 deletion pieces/InformationExtractionPiece/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from pydantic import BaseModel, Field, FilePath, Extra
from pydantic import BaseModel, Field, Extra
from enum import Enum
from typing import List

Expand Down
4 changes: 2 additions & 2 deletions pieces/PromptCreatorForImageGeneratorPiece/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from pydantic import BaseModel, Field, FilePath
from pydantic import BaseModel, Field
from enum import Enum


Expand Down Expand Up @@ -61,7 +61,7 @@ class OutputModel(BaseModel):
default=None,
description="The generated prompt to pass to an image generator AI",
)
generated_prompt_file_path: FilePath = Field(
generated_prompt_file_path: str = Field(
default=None,
description="The path to the generated prompt, in .txt format",
)
Expand Down
4 changes: 2 additions & 2 deletions pieces/TextGeneratorPiece/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from pydantic import BaseModel, Field, FilePath
from pydantic import BaseModel, Field
from enum import Enum
from typing import List

Expand Down Expand Up @@ -79,7 +79,7 @@ class OutputModel(BaseModel):
default=None,
description="The generated text as a string"
)
file_path_generated_text: FilePath = Field(
file_path_generated_text: str = Field(
default=None,
description="The path to text file containing generated text"
)
Expand Down
6 changes: 3 additions & 3 deletions pieces/TextSummarizerPiece/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from pydantic import BaseModel, Field, FilePath
from pydantic import BaseModel, Field
from enum import Enum


Expand Down Expand Up @@ -31,7 +31,7 @@ class InputModel(BaseModel):
default=None,
description="Text to summarize",
)
text_file_path: FilePath = Field(
text_file_path: str = Field(
default=None,
description="Use it only if not using text field. File path to the text to summarize"
)
Expand Down Expand Up @@ -69,7 +69,7 @@ class OutputModel(BaseModel):
default=None,
description="summarized text"
)
file_path_summarized_text: FilePath = Field(
file_path_summarized_text: str = Field(
default=None,
description="Path to summarized text file"
)
Expand Down
3 changes: 1 addition & 2 deletions pieces/TextSummarizerPiece/test_text_summarizer_piece.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
from domino.testing import piece_dry_run
from pydantic import FilePath
import tiktoken
import os

def run_piece(
output_type: str,
completion_max_tokens: int,
text: str = None,
text_file_path: FilePath = None,
text_file_path: str = None,
chunk_size: int = 1000,
chunk_overlap_rate: float = 0.2,
openai_model: str = "gpt-3.5-turbo",
Expand Down

0 comments on commit ee46092

Please sign in to comment.