"""
@Author: obstacles
@Time:  2025-06-04 15:57
@Description:  
"""
from openai import AsyncOpenAI, OpenAI

messages = [{'role': 'system', 'content': 'You name is alex, an helpful AI assistant,your goal is find the answer to the user\'s question, help the user to solve the problem.\nYou constraint is utilize the same language for seamless communication and always give a clearly in final reply with format json format {"FINAL_ANSWER": Your final answer here} if you think `goal` is finished do not give ANY other information except this json. Pay attention to historical information to distinguish and make decision.\nYou have some tools that you can use to help the user or meet user needs.\nBefore calling any tool, you must fully understand the tool\'s functions and their arguments.\nAlways reason step by step.  If any argument is unknown or ambiguous, consider using other available tools (such as search or file inspection tools) to gather the necessary information before calling the target tool.\nEnsure the types and values of all arguments you provide to the tool functions are correct.\nIf there is an error in calling the tool, you need to fix it yourself.\n\n        '}, {'role': 'user', 'content': '(user): 说明我这个项目根目录下的logs.py，根目录位置一般会包含Dockerfile'}]
timeout = 60
stream = False
max_tokens = 4096
temperature = 1.0
model = 'o4-mini'
model = 'gpt-4.1'
model = "gemini-2.5-pro-preview-03-25"
tools = [{'type': 'function', 'function': {'name': 'file_operation', 'description': 'Custom editing tool for viewing, creating and editing files\n* State is persistent across command calls and discussions with the user\n* If `path` is a file, `view` displays the result of applying `cat -n`.  If `path` is a directory, `view` lists non-hidden files and directories up to 2 levels deep\n* The `create` command cannot be used if the specified `path` already exists as a file\n* If a `command` generates a long output, it will be truncated and marked with `<response clipped>`\n* The `undo_edit` command will revert the last edit made to the file at `path`\n\nNotes for using the `str_replace` command:\n* The `old_str` parameter should match EXACTLY one or more consecutive lines from the original file.  Be mindful of whitespaces!\n* If the `old_str` parameter is not unique in the file, the replacement will not be performed.  Make sure to include enough context in `old_str` to make it unique\n* The `new_str` parameter should contain the edited lines that should replace the `old_str`', 'parameters': {'type': 'object', 'properties': {'command': {}, 'path': {'type': 'string', 'description': 'Absolute path to file or directory.'}, 'file_text': {'type': 'string', 'description': 'Required parameter of `create` command, with the content of the file to be created.'}, 'old_str': {'type': 'string', 'description': 'Required parameter of `str_replace` command containing the string in `path` to replace.'}, 'new_str': {'type': 'string', 'description': 'Optional parameter of `str_replace` command containing the new string (if not given, no string will be added). Required parameter of `insert` command containing the string to insert.'}, 'insert_line': {'type': 'integer', 'description': 'Required parameter of `insert` command. The `new_str` will be inserted AFTER the line `insert_line` of `path`.'}, 'view_range': {'type': 'array', 'description': 'Optional parameter of `view` command when `path` points to a file. If none is given, the full file is shown. If provided, the file will be shown in the indicated line number range, e.g. [11, 12] will show lines 11 and 12. Indexing at 1 to start. Setting `[start_line, -1]` shows all lines from `start_line` to the end of the file.', 'items': {'type': 'integer', 'description': ''}}}, 'required': ['command', 'path']}}}, {'type': 'function', 'function': {'name': 'generate_tweet', 'description': 'Use this tool to generate a cz tweet can be posted on x website.', 'parameters': {'type': 'object', 'properties': {'topic': {'type': 'string', 'description': '`topic` is an optional parameter that guides tweet generation toward a specific theme, subject, or keyword.\nIf the user’s input clearly expresses a desire to focus on a particular topic (e.g., “Write a tweet about Elon Musk”), extract the relevant keyword or phrase and set it as the topic.\nIf the input is vague or does not suggest any particular direction (e.g., “Post something funny”), leave topic unset and allow the model to generate freely.\n'}}, 'required': []}}}, {'type': 'function', 'function': {'name': 'python_execute', 'description': 'Executes Python code string. Note: Only print outputs are visible, function return values \n    are not captured. Use print statements to see results.', 'parameters': {'type': 'object', 'properties': {'code': {'type': 'string', 'description': 'The Python code to execute.'}}, 'required': ['code']}}}, {'type': 'function', 'function': {'name': 'execute_command', 'description': "Request to execute a CLI(Command-Line Interface) command on the system.\nUse this when you need to perform system operations or run specific commands to accomplish any step in the user's task.\nYou must tailor your command to the user's system and provide a clear explanation of what the command does.\nPrefer to execute complex CLI commands over creating executable scripts, as they are more flexible and easier to run.\nCommands will be executed in the current working directory.\nNote: You MUST append a `sleep 0.05` to the end of the command for commands that will complete in under 50ms, as this will circumvent a known issue with the terminal tool where it will sometimes not return the output when the command completes too quickly.\n", 'parameters': {'type': 'object', 'properties': {'command': {'type': 'string', 'description': '(required) The CLI command to execute. This should be valid for the current operating system. Ensure the command is properly formatted and does not contain any harmful instructions.'}}, 'required': ['command']}}}, {'type': 'function', 'function': {'name': 'web_search', 'description': 'Performs a web search using a search engine to find real-time, up-to-date information from the\n     internet. Use this tool when you need current information beyond your knowledge cut-off date, or to find specific\n      facts, news, articles, or general information on any topic not readily available in your training data.\n      When to use:\n        "To find information about current events, news, or topics that have developed after your last knowledge update.",\n        "To answer specific factual questions that require up-to-date information (e.g., \'What is the current stock price of AAPL? \', \'When is the next solar eclipse visible from North America?\').",\n        "When asked to find specific articles, research papers, product details, or official documentation available online.",\n        "To verify information or find diverse perspectives on a topic from multiple web sources.",\n        "When the user explicitly asks you to search the internet or \'Google\' something.",\n        "If your internal knowledge is insufficient, too general, or likely outdated for the user\'s query."\n      ', 'parameters': {'type': 'object', 'properties': {'query': {'type': 'string', 'description': 'The search query text.'}, 'num_results': {'type': 'integer', 'description': 'The number of search results to return. Default is 3.'}}, 'required': ['query']}}}]

cli = OpenAI(base_url='https://api.evo4ai.com/v1', api_key='sk-eE6Rl0A3XmvPoCz_032Ud9ZVuPUSTiKpFs4cU58hWyIpBTVSOvVA2kCDEY4')
resp = cli.chat.completions.create(
    messages=messages,
    timeout=timeout,
    stream=stream,
    max_tokens=max_tokens,
    temperature=temperature,
    model=model,
    tools=tools
)
# resp.raise_for_status()
print(resp)
