Skip to content

Commit

Permalink
feat(integrations): add typespec for filename argument
Browse files Browse the repository at this point in the history
  • Loading branch information
Vedantsahai18 committed Nov 9, 2024
1 parent 8dbf489 commit a0781c8
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 2 deletions.
8 changes: 8 additions & 0 deletions agents-api/agents_api/autogen/Tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -983,6 +983,10 @@ class LlamaParseFetchArguments(BaseModel):
"""
Language of the text. Default is English.
"""
filename: str | None = None
"""
File Name. If not provided, a random name will be generated.
"""
file: str
"""
The base64 string of the file
Expand Down Expand Up @@ -1013,6 +1017,10 @@ class LlamaParseFetchArgumentsUpdate(BaseModel):
"""
Language of the text. Default is English.
"""
filename: str | None = None
"""
File Name. If not provided, a random name will be generated.
"""
file: str | None = None
"""
The base64 string of the file
Expand Down
8 changes: 8 additions & 0 deletions integrations-service/integrations/autogen/Tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -983,6 +983,10 @@ class LlamaParseFetchArguments(BaseModel):
"""
Language of the text. Default is English.
"""
filename: str | None = None
"""
File Name. If not provided, a random name will be generated.
"""
file: str
"""
The base64 string of the file
Expand Down Expand Up @@ -1013,6 +1017,10 @@ class LlamaParseFetchArgumentsUpdate(BaseModel):
"""
Language of the text. Default is English.
"""
filename: str | None = None
"""
File Name. If not provided, a random name will be generated.
"""
file: str | None = None
"""
The base64 string of the file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ async def parse(
# Decode base64 file content
file_content = base64.b64decode(arguments.file)
extra_info = {
"file_name": str(uuid.uuid4())
} # Generate a random UUID for the filename
"file_name": arguments.filename if arguments.filename else str(uuid.uuid4())
}

# Parse the document
documents = await parser.aload_data(file_content, extra_info=extra_info)
Expand Down
3 changes: 3 additions & 0 deletions typespec/tools/llama_parse.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ model LlamaParseFetchArguments {
/** Language of the text. Default is English.*/
language?: string = "en";

/** File Name. If not provided, a random name will be generated. */
filename?: string;

/** The base64 string of the file*/
file: string;
}
Expand Down
6 changes: 6 additions & 0 deletions typespec/tsp-output/@typespec/openapi3/openapi-1.0.0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7086,6 +7086,9 @@ components:
type: string
description: Language of the text. Default is English.
default: en
filename:
type: string
description: File Name. If not provided, a random name will be generated.
file:
type: string
description: The base64 string of the file
Expand Down Expand Up @@ -7115,6 +7118,9 @@ components:
type: string
description: Language of the text. Default is English.
default: en
filename:
type: string
description: File Name. If not provided, a random name will be generated.
file:
type: string
description: The base64 string of the file
Expand Down

0 comments on commit a0781c8

Please sign in to comment.