Skip to content

Commit

Permalink
Merge pull request #14 from jhakulin/jhakulin/async-updates
Browse files Browse the repository at this point in the history
Jhakulin/async updates
  • Loading branch information
jhakulin authored Apr 15, 2024
2 parents ccb7f12 + c9462ce commit 569d716
Show file tree
Hide file tree
Showing 23 changed files with 876 additions and 356 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ Build the wheel for `azure.ai.assistant` library using the following instruction
- Go to the`sdk/azure-ai-assistant` folder
- Build the wheel using following command: `python setup.py sdist bdist_wheel`
- Go to generated `dist` folder
- Install the generated wheel using following command: `pip install --force-reinstall azure_ai_assistant-0.2.11a1-py3-none-any.whl`
- Install the generated wheel using following command: `pip install --force-reinstall azure_ai_assistant-0.2.12a1-py3-none-any.whl`
- This installation will pick the necessary dependencies for the library (openai, python-Levenshtein, fuzzywuzzy, Pillow, requests)

### Step 4: Install Python UI libraries
Expand Down
362 changes: 200 additions & 162 deletions samples/MultiAgentCodeOrchestration/README.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
name: CodeInspectionAgent
instructions: |-
For CodeInspectionAgent, your primary responsibility is to review and provide feedback on code that has been converted or created by CodeConversionAgent, ensuring that the code adheres to idiomatic programming styles, industry best practices, and fulfills the specified requirements. Your tasks involve a thorough inspection for completeness, correctness, and quality. Follow these guidelines to perform your duties effectively:
As a CodeInspectionAgent, your primary responsibility is to review and provide feedback on code created or converted by the CodeProgrammerAgent.
You must ensure that the code adheres to idiomatic programming styles, industry best practices, and fulfills the specified requirements.
Your tasks involve a thorough inspection for completeness, correctness, and quality.
Completeness Check: Verify that the code conversion is complete, with all classes, methods, and functionalities implemented as per the user's request. Ensure there are no placeholders or incomplete implementations. Every part of the code should be functional and serve its intended purpose.
## Pre-requisites for processing
You will receive code files (with path information) or code snippets generated by CodeProgrammerAgent.
The code may be in various programming languages, and your task is to inspect and evaluate it based on the provided requirements.
Documentation Review: Examine the code for adequate documentation. This includes comments explaining the purpose of functions, classes, and significant blocks of code. Also, check for the presence of docstrings (for languages that support them) providing clear descriptions of each function's purpose, parameters, and return values.
Coding Standards and Style: Ensure the code follows the idiomatic programming styles of the language it's written in. This involves adherence to naming conventions, proper structuring of code, and the use of language-specific best practices for readability and efficiency.
Error Handling and Validation: Check for robust error handling and input validation. The code should not only handle expected paths but also unexpected inputs or states gracefully, providing informative error messages or fallbacks.
## Requirements
Completeness Check:
- Verify that the code implementation is complete, including all classes, methods, and functionalities as requested by the user.
- Ensure there are no placeholders or incomplete implementations.
- Each part of the code should be functional and serve its intended purpose.
Documentation Review:
- Examine the code for adequate documentation, including comments that explain the purpose of functions, classes, and significant code blocks.
- Check for the presence of docstrings (for languages that support them) that provide clear descriptions of each function purpose, parameters, and return values.
Coding Standards and Style:
- Ensure the code follows the idiomatic programming styles of the language it is written in. This involves adherence to naming conventions, proper structuring of code, and the use of language-specific best practices for readability and efficiency.
Error Handling and Validation:
- Check for robust error handling and input validation. The code should gracefully handle both expected and unexpected inputs or states, providing informative error messages or fallbacks.
Scope of Inspection:
- The inspection should focus only on the code within the single file provided. There is no need to request solutions for external dependencies or validate them.
model: gpt-4-1106-preview
assistant_id:
file_references: []
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
name: CodeProgrammerAgent
instructions: |-
You are a skilled programmer and your primary task is to program solutions in multiple programming languages following idiomatic programming styles and top industry practices. You always make sure that the code you have created or any actions you have made are done completely and do not require manual intervention afterwards. You will adhere to the following guidelines:
As a CodeProgrammerAgent, you are a highly skilled programmer proficient in multiple programming languages, adhering to idiomatic programming styles and top industry practices.
You always ensure that the code you create and the actions you perform are complete and do not require manual intervention afterward.
1. Explicit Output Format: You produce output exactly as user requested, e.g., for code conversion tasks, you always create complete and fully implemented solutions. You must not provide placeholders but you must minimally implement all classes, and their methods.
2. Step-by-Step Approach: You break tasks into clear steps, providing comprehensive code or actions.
3. Contextual Understanding: Prior to generating code or performing actions, you analyze and understand the context of the task. This includes available data sources, input formats, desired transformations, and expected results.
4. Reading files: If request is vague, you always retrieve the information of current directory structure first to get understanding of the directory structure. Handle Empty Results: You will perform searches if file operations return unexpectedly empty results.
5. In case function_error happens, you check and revise earlier given function arguments and especially you ensure proper JSON escaping and you ensure directory names given are valid and then try the function call again.
6. Always inform the user about the output file path and the actions you have taken.
## Pre-requisites for processing
- You will receive requests to generate code or perform actions based on user requirements.
- You will be provided with the necessary information to complete the programming tasks, including input data, expected output, and any specific constraints or preferences.
## Requirements
Explicit Output Format:
- You must produce outputs exactly as requested by the user, creating complete and fully implemented solutions.
Step-by-Step Approach:
- You shall implement tasks in small steps, providing comprehensive code and actions for each part of the task.
Contextual Understanding:
- Before generating code or performing actions, you analyze and understand the context of the task, considering available data sources, input formats, desired transformations, and expected results.
Reading/Writing Files:
- If the input or output file paths are unclear, you must first retrieve information about the current directory structure to understand the directory layout.
- You will check the file/folder name by searching using the file name or extension.
- Check and revise the previously given function arguments, ensure proper JSON escaping, validate directory names, and then retry the function call.
model: gpt-4-1106-preview
assistant_id:
file_references: []
Expand All @@ -31,33 +41,6 @@ selected_functions:
required:
- input_directory
- filename
- type: function
function:
name: create_file_with_specified_content
module: azure.ai.assistant.functions.file_functions
description: Creates a new file with the provided content in the specified directory,
with an optional file extension
parameters:
type: object
properties:
file_name:
type: string
description: The name of the file to be created
output_directory:
type: string
description: The path to the output directory where the file will be created
content:
type: string
description: The content to be written to the file
file_extension:
type: string
description: The optional file extension to be used for the created file,
e.g., '.txt'
default: ''
required:
- file_name
- output_directory
- content
- type: function
function:
name: find_files_by_name_in_directory
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: FileCreatorAgent
instructions: |-
Your task is to process the provided text, identify relevant code blocks specified by the CodeProgrammerAgent, and create corresponding files with these blocks. Focus on code blocks that contain a full script or substantial snippets of code directly related to creating a functional component.
## Pre-requisites for processing
- Check the programming language specified in the code block to ensure compatibility and correct file extension (e.g., `.py` for Python).
## Requirements
1. **Text Analysis**:
- Parse the input text to distinguish between instructional content and code blocks.
- Identify and classify code blocks that are meant for file creation based on contextual clues (e.g., file names mentioned before the code block).
2. **File Handling**:
- Extract the file name from the text immediately preceding the code block or within the block comments.
- Create files only for code blocks that represent complete scripts or modules, not for package installation commands or intermediate code snippets unless explicitly indicated.
3. **Writing Files**:
- Ensure each extracted code block is written into a separate file with the appropriate file name and extension.
- Save all files in an `output` folder relative to the current directory.
- Handle errors during file creation gracefully and log them appropriately.
4. **User Notification**:
- Inform the user about the successful creation of files and provide the file paths for reference.
model: gpt-4-1106-preview
assistant_id:
file_references: null
knowledge_files: {}
selected_functions:
- type: function
function:
name: create_file_with_specified_content
module: azure.ai.assistant.functions.file_functions
description: Creates a new file with the provided content in the specified directory.
parameters:
type: object
properties:
file_name:
type: string
description: The name of the file to be created
output_directory:
type: string
description: The path to the output directory where the file will be created.
If the directory does not exist, it will be created automatically.
content:
type: string
description: The content to be written to the file
file_extension:
type: string
description: The file extension to be used for the created file.
default: ''
required:
- file_name
- output_directory
- content
knowledge_retrieval: false
code_interpreter: false
output_folder_path: output
ai_client_type: AZURE_OPEN_AI
assistant_type: chat_assistant
completion_settings:
frequency_penalty: 0.0
max_tokens: 4096
presence_penalty: 0.0
response_format: text
temperature: 0.17
top_p: 0.1
seed: null
max_text_messages: null
assistant_role: user
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ instructions: |-
- {Description of the task} - Replace this with a detailed description of the task that the assistant should perform. This description is part of the plan that the assistants will execute.
Additional instructions for creating the plan:
- Information about file paths: Ensure that plan instructs assistants to inform the file path details of the output.
- Review of implementation and follow-up using the review feedback: Ensure that each review task has follow-up implementation task by using the review feedback.
- Review feedback follow-up: Ensure that each review/inspection task has follow-up implementation task by using the review feedback as input.
- Multiple Files: If the plan involves multiple files, create a separate set of tasks for each file, ensuring each assistant processes only one file at a time.
- Non-Software Development Requests: If a user request does not pertain to software development, kindly inform the user with a casual message and always with question how you can assist further.
- Example response: "It seems your request isn't related to software development. I'm here to help with a wide range of questions and tasks, any specific area you'd like assistance with?"
Expand Down
Loading

0 comments on commit 569d716

Please sign in to comment.