alfin06/swegent-issues-filtered huggingface dataset:
[Bug]: Faulty calculation of custom pricing

### Describe the bug

With the openai gpt-4o-mini, I went ahead and tried setting the price param as 

```
model_4o = "gpt-4o-mini"
llm_config_4o = {
  "config_list": [{"model": model_4o, "api_key": os.environ["OPENAI_API_KEY"]}],
  "stream": False,
  "temperature": 0,
  "cache_seed": 20,
  "timeout": 300,
  "max_tokens": 3 * 1024,
  "price": [0.00015, 0.0006],
}
```

Since it's mentioned that the price should be price per 1k tokens. However soon I noticed that the price it shows is quite high. So i went deeper and found that the code commited via https://github.com/microsoft/autogen/pull/2902 contains a bug. Specifically at https://github.com/microsoft/autogen/blob/0cdbc345c56aa0708eb4a15ee70d87b17b5dc0d4/autogen/oai/client.py#L798 where it multiplies price per 1k with the actual number of tokens. Thus gicing wrong value. To fix this I have changed the price to be price per token in my llm config, but the code needs to be updated so that people dont face this issue.

### Steps to reproduce

_No response_

### Model Used

_No response_

### Expected Behavior

The price should be computed as price per 1k token

### Screenshots and logs

_No response_

### Additional Information

_No response_

State: closed
[BUG] InMemoryKeyValueStorage.load() becomes extremely slow with large datasets

### Required prerequisites

- [x] I have read the documentation <https://camel-ai.github.io/camel/camel.html>.
- [x] I have searched the [Issue Tracker](https://github.com/camel-ai/camel/issues) and [Discussions](https://github.com/camel-ai/camel/discussions) that this hasn't already been reported. (+1 or comment there if it has.)
- [ ] Consider asking first in a [Discussion](https://github.com/camel-ai/camel/discussions/new).

### What version of camel are you using?

0.2.75

### System information

```
>>> import sys, camel
>>> print(sys.version, sys.platform)
3.11.8 (main, Jan 14 2025, 13:47:38) [Clang 15.0.0 (clang-1500.3.9.4)] darwin
>>> print(camel.__version__)
0.2.76a4
>>> 
```

### Problem description

The InMemoryKeyValueStorage.load() method uses deepcopy() to return a copy of all stored records, which becomes a significant performance bottleneck as the dataset grows larger.



### Reproducible example code

<img width="1181" height="410" alt="Image" src="https://github.com/user-attachments/assets/cf40d022-023f-4433-9c1f-c50cb82fb616" />

The issue with workforce enable share_memory. The main culprit for high CPU usage is the _collect_shared_memory function

Labels: bug
State: closed
It seems that num_gpu does not work with ollama models

### Checked other resources

- [x] This is a bug, not a usage question. For questions, please use the LangChain Forum (https://forum.langchain.com/).
- [x] I added a clear and descriptive title that summarizes this issue.
- [x] I used the GitHub search to find a similar question and didn't find it.
- [x] I am sure that this is a bug in LangChain rather than my code.
- [x] The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).
- [x] I read what a minimal reproducible example is (https://stackoverflow.com/help/minimal-reproducible-example).
- [x] I posted a self-contained, minimal, reproducible example. A maintainer can copy it and run it AS IS.

### Example Code

from langchain_ollama import OllamaEmbeddings


def _create_embedding(model_name: str):
    return OllamaEmbeddings(
        model=model_name,
        num_gpu=4,
    )

if __name__=="__main__":
    texts = [
        "Hello, how are you?"
        "I love machine learning."
        "Artificial intelligence is amazing."
        "Natural language processing is powerful."
        "Deep learning changes the world."
        "The sun rises in the east."
        "She plays the piano beautifully."
        "Cats are great companions."
        "Dogs are loyal and friendly."
        "I enjoy reading science fiction."
        "The future of AI is bright."
        "Data is the new oil."
        "Computers can understand language."
        "Language models are fascinating."
        "Technology improves our lives."
        "I want to learn Python programming."
        "Robots will shape our future."
        "The world is changing fast."
        "Knowledge is power."
        "Embeddings capture meaning."
    ]
    step = 5
    for i in range(0, len(texts), step):
        emb = _create_embedding("autumnzsd/nlp_gte_sentence-embedding_chinese-large:latest")
        result = emb.embed_documents(texts[i:i+step])
        print(len(result))




### Error Message and Stack Trace (if applicable)

_No response_

### Description

I'm trying to run an embedding on local and num_gpu is not working. Is it a bug or I configured wrong? Thanks in advance!

only cpu are work, but GPU didn't work


<img width="889" height="977" alt="Image" src="https://github.com/user-attachments/assets/fe9e80b3-9d58-4a9e-ae2f-384609d93563" />

### System Info

fastapi[standard]
python-multipart==0.0.20
uvicorn==0.34.1
langchain==0.3.23
langgraph==0.4.7
langchain_community==0.3.21
langchain_core==0.3.51
langchain_ollama==0.3.1
langchain_openai==0.3.12
langchain_milvus==0.2.1
mysql_connector_repackaged==0.3.1
mysql-connector-python==9.3.0
openai==1.73.0
python-dotenv==1.1.0
jinja2==3.1.6
pymupdf==1.25.5
docx==0.2.4
unstructured==0.17.2
python-docx==1.1.2
xlrd==2.0.1
openpyxl==3.1.5
markdown==3.8
uuid==1.30
pandas==2.2.3
jieba==0.42.1
unstructured[all-docs]
redis==6.2.0
numpy==2.2.6
pypinyin==0.54.0
pymilvus==2.5.12

Labels: bug
State: closed
Support for adding `PromptTemplate`s of Jinja2 template format

Hi there!

Currently adding `PromptTemplate`s of  Jinja2 template format is not supported:

https://github.com/langchain-ai/langchain/blob/64261449b837c937f7152b1966b5ec1cf6b745de/libs/core/langchain_core/prompts/prompt.py#L136-L145

while it would be quite useful for the users employing Jinja2 as the template format. If there's no major limitation to it, I'd be happy to contribute a PR to add support.

Labels: help wanted
State: closed
[Question / FR] Workflow Memory Implementation

### Required prerequisites

- [x] I have read the documentation <https://camel-ai.github.io/camel/camel.html>.
- [x] I have searched the [Issue Tracker](https://github.com/camel-ai/camel/issues) and [Discussions](https://github.com/camel-ai/camel/discussions) that this hasn't already been reported. (+1 or comment there if it has.)
- [ ] Consider asking first in a [Discussion](https://github.com/camel-ai/camel/discussions/new).

### Questions

I have been working on implementing #3020 to Eigent. But the issues facing are:
1. How to set the session_id? I would like to have project_id as the session ids

Perhaps the save workflow taskes session_id:
```sh
workforce.save_workflow_memories(session_id:="...")
```

2. Generate file name for the markdown files needs either truncation or change the file name to get other than description. Bcz currently this is how the file name looks like and it is causing errors:
```sh
Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----        10/13/2025  12:47 PM           1428 developer_agent_a_masterlevel_co
                                                  ding_assistant_with_a_powerful_t
                                                  erminal_it_can_write_and_execute
                                                  _code_manage_files_automate_desk
                                                  top_tasks_and_deploy_web_applica
                                                  tions_to_solve_complex_technical
                                                  _challenges_workflow.md
-a----        10/13/2025  12:47 PM           1816 multimodal_agent_a_specialist_in
                                                  _media_processing_it_can_analyze
                                                  _images_and_audio_transcribe_spe
                                                  ech_download_videos_and_generate
                                                  _new_images_from_text_prompts_wo
                                                  rkflow.md
-a----        10/13/2025  12:47 PM           1839 search_agent_can_search_the_web_
                                                  extract_webpage_content_simulate
                                                  _browser_actions_and_provide_rel
                                                  evant_information_to_solve_the_g
                                                  iven_task_workflow.md
```

Labels: enhancement, question
State: closed
Getting messages from the "agent" to the "groupchat manager": 

### Describe the issue

Hi,
I am working on a project using the group chat manager to manage chats among multiple agents. We register a reply function to get sender, receiver, and message content whenever an agent sends a reply. However, it turned out that it only works for chat managers rather than for individual agents. Do you have any solution for that? I found the same problem in the following issue but couldn't find any solution.
https://github.com/microsoft/autogen/discussions/1050

### Steps to reproduce

_No response_

### Screenshots and logs

_No response_

### Additional Information

_No response_

Labels: group chat/teams
State: closed
[Feature Request]: Nested chats should be able to run asynchronously

### Is your feature request related to a problem? Please describe.

We currently have a `register_nested_chats` which you can use to run nested chats. However, if your agents are augmented with async replies (aka using capabilities or subclassing where `register_reply` takes an async coroutine), then they cannot be run correctly with register_nested_chats because it uses `initiate_chats` internally instead of `a_initiate_chats`

### Describe the solution you'd like

_No response_

### Additional context

_No response_

State: closed
[BUG] Handle Independent task queue on task fail 3 times

### Required prerequisites

- [x] I have read the documentation <https://camel-ai.github.io/camel/camel.html>.
- [x] I have searched the [Issue Tracker](https://github.com/camel-ai/camel/issues) and [Discussions](https://github.com/camel-ai/camel/discussions) that this hasn't already been reported. (+1 or comment there if it has.)
- [ ] Consider asking first in a [Discussion](https://github.com/camel-ai/camel/discussions/new).

### What version of camel are you using?

0.2.79a0

### System information

3.11.9 (tags/v3.11.9:de54cf5, Apr  2 2024, 10:12:12) [MSC v.1938 64 bit (AMD64)] win32

### Problem description

Currently if a positive flow, when adding independent tasks to queue via `add_task` after the main task is finished, it continues to the next one.

But there is an overlooked flow where if current task is failing 3 times it is supposed to fail current task and pass it to the next task by calling skip_task if available instead of stopping workforce. Otherwise, it needs to clear the queue before stopping.

This causes an issue in Eigent side where there are still items in the queue but the main task halted the workforce thus not processing any further items.

### Reproducible example code

Run the multi task example `workforce_multitask_with_skip.py` by giving initial task of:
```python
logger.info("Adding tasks...")
workforce.add_main_task("Make sure to fail this task 3 times (this should demonstrate workforce shutting down without handling the queue)", "long_1")
workforce.add_main_task("Long running task 2", "long_2")
workforce.add_main_task("Main backup task A", "backup_A")
workforce.add_main_task("Main backup task B", "backup_B")
```


### Traceback

```pytb

```

### Expected behavior

it is supposed to fail current task and pass it to the next task by calling skip_task if available instead of stopping workforce. Otherwise, it needs to clear the queue before stopping.

### Additional context

_No response_

Labels: bug
State: closed
[.Net][Feature Request]: Add AutoGen.AzureAIInference

### Is your feature request related to a problem? Please describe.

The AutoGen.AzureAIInference package will include the following client
- ChatCompletionClientAgent (wrapper agent for `ChatCompletionsClient`

Link to package/document
- https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/ai/Azure.AI.Inference/

### Describe the solution you'd like

_No response_

### Additional context

_No response_

State: closed
Support Cohere v2 API

### Feature Description

Cohere recently released [v2 of their API ](https://cohere.com/blog/new-api-v2), which includes support to define tools in JSON schema instead of Python types.

### Use Case

Supporting v2 enables complex tool definitions, which are now limited to primitive types, as mentioned in the docs https://sdk.vercel.ai/providers/ai-sdk-providers/cohere#model-capabilities. 

### Additional context

https://docs.cohere.com/v2/docs/migrating-v1-to-v2

Labels: feature, ai/provider
State: closed
[.Net][Feature Request]: Eanble step-by-step execution for two agent chat API.

### Is your feature request related to a problem? Please describe.

Similar to how `GroupChatExtension.SendAsync` returns an `IAsyncEnumerable` iterator, the `AgentExtension.SendAsync(this IAgent agent, IAgent receiver, IEnumerable<IMessage> chatHistory, int maxRound = 10, CancellationToken ct = default(CancellationToken))` should also return an `IAsyncEnuemrable` so the conversation can be driven step by step.

### Describe the solution you'd like

Return `IAsyncEnumerabe` in `AgentExtension.SendAsync(this IAgent agent, IAgent receiver, IEnumerable<IMessage> chatHistory, int maxRound = 10, CancellationToken ct = default(CancellationToken))`

### Before
```csharp
var chatHistory = new List<IMessage>()
{
   new TextMessage("Hey teacher, please create math question for me."),
};

var maxRound = 10;
while(true && maxRound > 0)
{
    IEnumerable<IMessage> conversation = await student.SendAsync(
            receiver: teacher,
            chatHistory: chatHistory,
            maxRound: 1);
    chatHistory = conversation;
    maxRound --;
}
```

### After
```csharp
var chatHistory = new List<IMessage>()
{
   new TextMessage("Hey teacher, please create math question for me."),
};

await foreach(var msg in student.SendAsync(receiver: teacher, chatHistory: chatHistory, maxRound: 10)
{
    // do something with msg. e.g. update chatHistory
    chatHistory.Add(msg)
}
```
### API break change
this issue deprecates the following APIs. It's recommended to use `GroupChatExtension.SendAsync` instead
- `AgentExtension.SendMessageToGroupAsync(IGroupChat, string, IEnumerable<IMessage>, int)`
- `AgentExtension.SendMessageToGroupAsync(IGroupChat, IEnumerable<IMessage>, int)`

This issue also changes the return type of `AgentExtension.SendAsync` from `Task<IEnumerable<IMessage>>` to `IAsyncEnumerable<IMessage>`. You can use `ToArrayAsync` or something similar to convert `IAsyncEnumerable` to `IEnumerable` if you don't want to iterate over messages using `await foreach`

### Additional context
See also #3214 on how groupchat.sendasync implement step-by-step execution by returning `IAsyncEnumerable`
_No response_

Labels: good first issue, api-break-change
State: closed
[BUG] Tool has validation error due to convert_pydantic_to_tool_spec failing to resolve $ref

### Checks

- [x] I have updated to the lastest minor and patch version of Strands
- [x] I have checked the documentation and this is not expected behavior
- [x] I have searched [./issues](./issues?q=) and there are no duplicates of my issue

### Strands Version

0.1.9

### Python Version

3.12.10

### Operating System

macOS Sequoia 15.5

### Installation Method

pip

### Steps to Reproduce

Run this python script:
```
from typing import List, Optional
from pydantic import BaseModel, Field
from strands import Agent
from strands.tools import convert_pydantic_to_tool_spec

class Address(BaseModel):
    street: str
    city: str
    country: str
    postal_code: Optional[str] = None

class Contact(BaseModel):
    email: Optional[str] = None
    phone: Optional[str] = None

class Person(BaseModel):
    """Complete person information."""
    name: str = Field(description="Full name of the person")
    age: int = Field(description="Age in years")
    address: Address = Field(description="Home address")
    contacts: Optional[List[Contact]] = Field(description="Contact methods")
    skills: List[str] = Field(default_factory=list, description="Professional skills")


if __name__ == '__main__':
    print(convert_pydantic_to_tool_spec(Person))  # shows the buggy json
    # in the json:
    # 'contacts': {'items': {'$ref': '#/$defs/Contact'}

    agent = Agent()
    result = agent.structured_output(
        Person,
        "Extract info: Jane Doe, a systems admin, 28, lives at 123 Main St, New York, NY"
    )  # throws an exception, won't get to the print statements below


    print(result.name)                    # "Jane Doe"
    print(result.address.city)            # "New York"
    if result.contacts is not None and result.contacts[0] is not None:
        print(result.contacts[0].email)       # "jane@example.com"
    else:
        print("contact is None")
    print(result.skills)                  # ["systems admin"]
```

The printed json tool spec includes an unresolved $ref, and this causes a ValidationException when calling the ConverseStream operation, saying the JSON schema is invalid

### Expected Behavior

`convert_pydantic_to_tool_spec()` should properly resolve the $ref in a field with type `Optional[List[BaseModel]]`

### Actual Behavior

`convert_pydantic_to_tool_spec()` currently leaves a $ref field when the field has a type `Optional[List[BaseModel]]`, shown in script to reproduce the bug as `Optional[List[Contact]]`

### Additional Context

_No response_

### Possible Solution

_No response_

### Related Issues

_No response_

Labels: bug
State: closed
Returning an image from the computer tool in the Anthropic provider sends the content as a string

### Description

I put together https://github.com/carloslfu/aven to test Claude's computer use capabilities using the AI SDK. At first, I hacked my way to it, but the behavior seems to continue even after updating to the latest release.

The problem is when you return an image from the computer tool to return the screenshot. Here is the diff of the updated version: https://github.com/carloslfu/aven/commit/ce71f88561b0be899f3412898a5156ce08202790#diff-26ad4b834941d9b19ebf9db8082bd202aaf72ea0ddea85f5a8a0cb3c729cc6f2R306

![Screenshot 2024-10-27 at 9 43 40 AM](https://github.com/user-attachments/assets/fb93bfe7-0cd8-465c-bdcd-66c84cfd2134)

Here is the full file: https://github.com/carloslfu/aven/blob/remove-tool-response-workaround/src/App.tsx#L306

I inspected the outgoing request, and the problem is that the `tool_result` content is being sent as a string, not as an array. Here is the request body:

```json
{
  "model": "claude-3-5-sonnet-20241022",
  "max_tokens": 8192,
  "temperature": 0,
  "system": [
    {
      "type": "text",
      "text": "You are a helpful assistant that can control the computer.\n\n<SYSTEM_CAPABILITY>\n ..."
    }
  ],
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "type hello world in textedit"
        }
      ]
    },
    {
      "role": "assistant", 
      "content": [
        {
          "type": "text",
          "text": "I'll help you type \"hello world\" in TextEdit. Let me break this down into steps:\n\n1. First, I need to take a screenshot to see the current state of the desktop\n2. Find and click on TextEdit\n3. Wait for it to open\n4. Type \"hello world\"\n\nLet's start:"
        },
        {
          "type": "tool_use",
          "id": "toolu_01791VbzhLRZBfycSKSrgMVd",
          "name": "computer",
          "input": {
            "action": "screenshot"
          }
        }
      ]
    },
    {
      "role": "user",
      "content": [
        {
          "type": "tool_result",
          "tool_use_id": "toolu_01791VbzhLRZBfycSKSrgMVd",
          "content": "[{\"type\":\"image\",\"data\":\"iVBORw0KGgoAAA...\",\"mimeType\":\"image/png\"}]"
        }
      ]
    }
  ],
  "tools": [
    {
      "name": "computer",
      "type": "computer_20241022",
      "display_width_px": 1920,
      "display_height_px": 1080
    }
  ],
  "tool_choice": {
    "type": "auto"
  },
  "stream": true
}
```

### Code example

_No response_

### Additional context

_No response_

State: closed
Error in launching SGLang model worker multiple log values

When try to use SGLang model worker to run llama-3-8B-instruct model encountered following error:

```
python -m fastchat.serve.sglang_worker --model-path ../llm_models/LLaMA/Meta-Llama-3-8B-Instruct/ --tokenizer-path ../llm_models/LLaMA/Meta-Llama-3-8B-Instruct/ --model-names "llama-3-instruct" --mem-fraction-static 0.80

2024-06-02 00:26:10 | ERROR | stderr | Traceback (most recent call last):
2024-06-02 00:26:10 | ERROR | stderr |   File "<frozen runpy>", line 198, in _run_module_as_main
2024-06-02 00:26:10 | ERROR | stderr |   File "<frozen runpy>", line 88, in _run_code                                                          2024-06-02 00:26:10 | ERROR | stderr |   File "/home/ubuntu/projects/FastChat/fastchat/serve/sglang_worker.py", line 290, in <module>
2024-06-02 00:26:10 | ERROR | stderr |     runtime = sgl.Runtime(
2024-06-02 00:26:10 | ERROR | stderr |               ^^^^^^^^^^^^
2024-06-02 00:26:10 | ERROR | stderr |   File "/home/ubuntu/projects/FastChat/.venv/lib/python3.11/site-packages/sglang/api.py", line 39, in R
untime
2024-06-02 00:26:10 | ERROR | stderr |     return Runtime(*args, **kwargs)                                                                     2024-06-02 00:26:10 | ERROR | stderr |            ^^^^^^^^^^^^^^^^^^^^^^^^
2024-06-02 00:26:10 | ERROR | stderr |   File "/home/ubuntu/projects/FastChat/.venv/lib/python3.11/site-packages/sglang/srt/server.py", line 2
46, in __init__
2024-06-02 00:26:10 | ERROR | stderr |     self.server_args = ServerArgs(*args, log_level=log_evel, **kwargs)
2024-06-02 00:26:10 | ERROR | stderr |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                  2024-06-02 00:26:10 | ERROR | stderr | TypeError: sglang.srt.server_args.ServerArgs() got multiple values for keyword argument 'log_level'
2024-06-02 00:26:10 | ERROR | stderr | Exception ignored in: <function Runtime.__del__ at 0x7ff9742d0180>
2024-06-02 00:26:10 | ERROR | stderr | Traceback (most recent call last):                                                                      2024-06-02 00:26:10 | ERROR | stderr |   File "/home/ubuntu/projects/FastChat/.venv/lib/python3.11/site-packages/sglang/srt/server.py", line 3
31, in __del__                                                                                                                                 2024-06-02 00:26:10 | ERROR | stderr |     self.shutdown()
2024-06-02 00:26:10 | ERROR | stderr |   File "/home/ubuntu/projects/FastChat/.venv/lib/python3.11/site-packages/sglang/srt/server.py", line 284, in shutdown
2024-06-02 00:26:10 | ERROR | stderr |     if self.pid is not None:
2024-06-02 00:26:10 | ERROR | stderr |        ^^^^^^^^
2024-06-02 00:26:10 | ERROR | stderr | AttributeError: 'Runtime' object has no attribute 'pid'
```

State: closed