Skip to content

Commit

Permalink
Small minor fixes to functions in Prompt functions (#1464)
Browse files Browse the repository at this point in the history
Small minor fixes to functions in Prompt functions

Just a couple of minor fixes.

No tests exist for this so just gotta trust me I guess
  • Loading branch information
rossdanlm authored Mar 19, 2024
2 parents d57f077 + fb29548 commit 714a178
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
10 changes: 7 additions & 3 deletions python/src/aiconfig/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,14 +196,18 @@ class Config:
extra = "allow"

def add_output(self, output: Output):
"""
Add the output to the prompt's output list
"""
if self.outputs is None:
self.outputs = [output]
self.outputs.append(output)

def get_raw_prompt_from_config(self):
def get_raw_prompt_from_config(self) -> str:
"""Gets raw prompt from config"""
if isinstance(self.input, str):
return self.input
else:
return self.input.prompt
return str(self.input.data)


class SchemaVersion(BaseModel):
Expand Down
3 changes: 1 addition & 2 deletions python/tests/test_dataclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ def test_get_raw_prompt_from_prompt_object_prompt_input():
prompt = Prompt(
name="test",
input=PromptInput(
prompt="This is a basic prompt",
data={},
data="This is a basic prompt",
),
metadata=PromptMetadata(
model=ModelMetadata(name="FakeMetadata", settings={}),
Expand Down

0 comments on commit 714a178

Please sign in to comment.