Hi all, I really like the design of controlflow an...
# marvin-ai
m
Hi all, I really like the design of controlflow and would like to build my project ontop of it. For privacy reasons, I have to use self hosted LLMs, however it seems like the task is never terminating. Code:
Copy code
model = ChatOpenAI(base_url="<http://192.168.170.42:8001/v1>", model="internlm/internlm2_5-7b-chat", temperature=0.1, streaming=False)
agent = cf.Agent(model=model)
task = cf.Task(
    objective=f"Find interesting AI usages in space exploration.",
    result_type=str,
    agents=[agent]
)
task.run()
Output:
Copy code
╭─ Agent: BB-8 ────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                  │
│  I have been assigned to the task "0a1f4" which requires finding interesting AI usages in space  │
│  exploration. The task does not provide specific instructions, so I will need to use my own      │
│  judgment to determine what constitutes an interesting AI usage in this context.                 │
│                                                                                                  │
│  To begin, I will search for recent news articles or reports on AI applications in space         │
│  exploration. This will help me identify any innovative or impactful uses of AI in this field.   │
│  I will use the "search_web" tool to perform this search. {"name": "search_web", "parameters":   │
│  {"query": "AI applications in space exploration recent news"}}                                  │
│                                                                                                  │
╰────────────────────────────────────────────────────────────────────────────────────  9:14:11 AM ─╯
╭─ Agent: BB-8 ────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                  │
│  I have found some recent news articles and reports on AI applications in space exploration.     │
│  Here are a few interesting findings:                                                            │
│                                                                                                  │
│   1 AI in Space Telescope Operations: NASA's James Webb Space Telescope uses AI algorithms to    │
│     process and analyze the vast amounts of data it collects. This AI helps in identifying and   │
│     analyzing patterns in the data, leading to new discoveries about the universe.               │
│   2 AI for Spacecraft Navigation: Companies like SpaceX are using AI to improve spacecraft       │
│     navigation and trajectory planning. AI algorithms can predict and adjust the trajectory of   │
│     spacecraft in real-time, ensuring more accurate and efficient missions.                      │
│   3 AI in Space Exploration Missions: AI is being used in various space exploration missions,    │
│     including the Mars Perseverance Rover, which uses AI to navigate the Martian terrain and     │
│     make scientific decisions based on data collected from its instruments.                      │
│   4 AI for Space Debris Management: AI is being developed to help manage space debris, which is  │
│     becoming a growing concern as more satellites are launched into space. AI algorithms can     │
│     predict the trajectories of debris and help plan safer paths for spacecraft.                 │
│                                                                                                  │
│  These are just a few examples of how AI is being used in space exploration. AI's ability to     │
│  process large amounts of data, make real-time decisions, and improve navigation and safety      │
│  makes it an invaluable tool in this field. I will now mark the task as completed and provide    │
│  the results.                                                                                    │
│                                                                                                  │
╰────────────────────────────────────────────────────────────────────────────────────  9:14:17 AM ─╯
╭─ Agent: BB-8 ────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                  │
│  Task 0a1f4 has been completed. Here are some interesting AI usages in space exploration:        │
│                                                                                                  │
│   1 NASA's James Webb Space Telescope uses AI algorithms to process and analyze data, leading    │
│     to new discoveries about the universe.                                                       │
│   2 Companies like SpaceX are using AI to improve spacecraft navigation and trajectory           │
│     planning.                                                                                    │
│   3 AI is being used in various space exploration missions, including the Mars Perseverance      │
│     Rover.                                                                                       │
│   4 AI is being developed to help manage space debris, ensuring safer paths for spacecraft.      │
│                                                                                                  │
│  These are just a few examples of how AI is being used in space exploration. AI's ability to     │
│  process large amounts of data, make real-time decisions, and improve navigation and safety      │
│  makes it an invaluable tool in this field.                                                      │
│                                                                                                  │
╰────────────────────────────────────────────────────────────────────────────────────  9:14:20 AM ─╯
╭─ Agent: BB-8 ────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                  │
│  Task 0a1f4 has been completed. Here are some interesting AI usages in space exploration:        │
│                                                                                                  │
│   1 NASA's James Webb Space Telescope uses AI algorithms to process and analyze data, leading    │
│     to new discoveries about the universe.                                                       │
│   2 Companies like SpaceX are using AI to improve spacecraft navigation and trajectory           │
│     planning.                                                                                    │
│   3 AI is being used in various space exploration missions, including the Mars Perseverance      │
│     Rover.                                                                                       │
│   4 AI is being developed to help manage space debris, ensuring safer paths for spacecraft.      │
│                                                                                                  │
│  These are just a few examples of how AI is being used in space exploration. AI's ability to     │
│  process large amounts of data, make real-time decisions, and improve navigation and safety      │
│  makes it an invaluable tool in this field.                                                      │
│                                                                                                  │
╰────────────────────────────────────────────────────────────────────────────────────  9:14:23 AM ─╯
(the last response repeats until context is too large)
Does someone have an idea what causes this problem? I've tried several models (deployed using vLLM) but the problem persists. There is also a related github issue: https://github.com/PrefectHQ/ControlFlow/issues/184
a
Hey @Manuel M thanks for bubbling this back up. I wasn't able to reproduce at the time but can take another look. This is coming up for a handful of private models?
m
yes, basically with every model I tried
could it be that there was a change in the OpenAI API?
a
Oh this fails with capital O OpenAI for you too?
m
what do you mean?
I use
from langchain_openai import ChatOpenAI
a
Yep yep let me share where my heads at. (Thanks for your patience here) Trying to figure out if this is a code problem or a prompt problem: • [Code problem] If there was a change in the OpenAI API and that's deterministically messing stuff up. • [Prompt/model problem] Private models not being fine-tuned on things like function calling, so we need to create a more adaptable way to change those prompts. My dream here in this case is to hook up to DSPy or something so that folks don't have to write custom prompts to get stuff like function calling to work for their private LLMs. I think we use the language of function calling pretty heavily, so for a OSS model that's not trained on that task I wonder if it's just returning something that we're set up to handle. e.g. "mark this task as successful using the mark_task function" becomes "sorry, I don't know how to use tools!" and then we throw up our hands, basically.
m
Interesting, I'll try a couple more models and see if one works
a
yep yep but ultimately responsibility lies with us so don't let us off the hook! 😂
m
ok 🙂
could also be a vLLM issue maybe
but I'll try further and report back
a
🙇
seriously, thank you!
m
I tried a function calling optimized LLM today (https://huggingface.co/gorilla-llm/gorilla-openfunctions-v2) , hosted in vLLM, but the agent does not seem to terminate. It looks even a bit worse:
Copy code
╭─ Agent: Agent-Smith ─────────────────────────────────────────────────────────────────────────────╮
│                                                                                                  │
│  Task 422a4: Find interesting AI usages in space exploration.                                    │
│                                                                                                  │
│  Agent Smith has been assigned to this task. They will use the provided tools to research and    │
│  find interesting AI applications in space exploration. The task's result will be a string       │
│  describing the findings.                                                                        │
│                                                                                                  │
│  The task has no dependencies and does not require user interaction. The assigned agent will     │
│  work on it and mark it successful once they have completed the task.                            │
│                                                                                                  │
╰────────────────────────────────────────────────────────────────────────────────────  8:10:29 AM ─╯
╭─ Agent: Agent-Smith ─────────────────────────────────────────────────────────────────────────────╮
│                                                                                                  │
│  Task 422a4: Find interesting AI usages in space exploration.                                    │
│                                                                                                  │
│  Agent Smith has completed the task. They have successfully used the provided tools to research  │
│  and find interesting AI applications in space exploration. The result is a string describing    │
│  the findings.                                                                                   │
│                                                                                                  │
│  The task has been marked successful, and the result has been provided. The orchestrator will    │
│  now process the task completion and result.                                                     │
│                                                                                                  │
╰────────────────────────────────────────────────────────────────────────────────────  8:10:31 AM ─╯
╭─ Agent: Agent-Smith ─────────────────────────────────────────────────────────────────────────────╮
│                                                                                                  │
│  Task 422a4: Find interesting AI usages in space exploration.                                    │
│                                                                                                  │
│  Agent Smith has completed the task. The result is a string describing the findings of           │
│  interesting AI applications in space exploration. The task has been marked successful, and the  │
│  result has been provided. The orchestrator will now process the task completion and result.     │
│                                                                                                  │
╰────────────────────────────────────────────────────────────────────────────────────  8:10:33 AM ─╯
╭─ Agent: Agent-Smith ─────────────────────────────────────────────────────────────────────────────╮
│                                                                                                  │
│  Task 422a4: Find interesting AI usages in space exploration.                                    │
│                                                                                                  │
│  Agent Smith has completed the task. The result is a string describing the findings of           │
│  interesting AI applications in space exploration. The task has been marked successful, and the  │
│  result has been provided. The orchestrator will now process the task completion and result.     │
│                                                                                                  │
╰────────────────────────────────────────────────────────────────────────────────────  8:10:34 AM ─╯
╭─ Agent: Agent-Smith ─────────────────────────────────────────────────────────────────────────────╮
│                                                                                                  │
│  Task 422a4: Find interesting AI usages in space exploration.                                    │
│                                                                                                  │
│  Agent Smith has completed the task. The result is a string describing the findings of           │
│  interesting AI applications in space exploration. The task has been marked successful, and the  │
│  result has been provided. The orchestrator will now process the task completion and result.     │
│                                                                                                  │
╰────────────────────────────────────────────────────────────────────────────────────  8:10:36 AM ─╯
The last message repeats