alfin06/swegent-issues-filtered huggingface dataset:
[Bug]: Type hint error because of improper field definition

### Bug Description

When using `OpenAILike` type checker like pyright argue about missing `max_tokens` and `api_version` parameters. This is not the case when `OpenAI` (which `OpenAILike` inherits from).
The reason is that for example [`api_version` field](https://github.com/run-llama/llama_index/blob/ad2efcdc5b57c30a3d9cd97ac3a750a0a97551ac/llama-index-integrations/llms/llama-index-llms-openai/llama_index/llms/openai/base.py#L220) is not optional and does not have a default value, but is indirectly set as [optional in the constructor](https://github.com/run-llama/llama_index/blob/ad2efcdc5b57c30a3d9cd97ac3a750a0a97551ac/llama-index-integrations/llms/llama-index-llms-openai/llama_index/llms/openai/base.py#L254). This unfortunately confuses the type checker. Why not make both fields optional and give them a default?

### Version

llama-index-llms-openai-like v0.3.5, lama-index-llms-openai v0.3.42

### Steps to Reproduce

When using
```
OpenAILike(
    model="my_model",
    api_key="foobar",
    api_base="https//whatever/v1",
    temperature=0.0,
)
```
pyright tells me `max_tokens` and `api_version` is missing.

### Relevant Logs/Tracbacks

```shell

```

Labels: bug, P2
State: closed
user instructions not passed in sql correction prompt

**Describe the bug**
In Sql Correction we are not passing user instructions 

**Expected behavior**

User Instructions are suppose to help with correction we should add it in sql correction flow.

Labels: bug
State: closed
[Feature Request]: Streamable-http for workflows as mcp tools

### Feature Description

The tutorial listed here (https://docs.llamaindex.ai/en/stable/examples/tools/mcp/#converting-a-workflow-to-an-mcp-app) speaks solely about SSE. However SSE is deprecated in newer versions of MCP implementation and is replaced with streamable http. 

The tutorials need to be updated. Moreover, since workflows can also have calls to LLMs inside them, it would help to have an example of an mcp tool which streams the response. 

### Reason

MCP has deprecated SSEs in favor of streamable HTTP. 

### Value of Feature

Keep the framework compatible with the newest standard of MCP. 

Labels: enhancement, triage
State: closed
[Feature Request]: Add rows/cols retrievers parameter in NLSQLTableQueryEngine

### Feature Description

Add `rows_retrievers` and `cols_retrievers` parameters to the  `NLSQLTableQueryEngine` class and forward them to  `NLSQLRetriever`.

### Reason

The `NLSQLTableQueryEngine` class is missing the `NLSQLRetriever`'s `rows_retrievers` and `cols_retrievers` parameters, forcing the user to manually build a `RetrieverQueryEngine` from a `NLSQLRetriever` object to use them.

### Value of Feature

This would allow the user to directly instanciate `NLSQLTableQueryEngine` objects with query-time rows and/or columns retrieval.

Labels: enhancement, triage
State: closed
[Bug]: Incorrect token counting for Google GenAI

### Bug Description

Incorrect token counting for Google GenAI models when using `complete` call.

### Version

0.12.37

### Steps to Reproduce

- Create custom callback manager and add token counting handler with verbosity mode on
- Trigger `complete` with a prompt
- Notice how the handler logs 2 different token counts

```python
import tiktoken
from llama_index.llms.google_genai import GoogleGenAI
from llama_index.core.callbacks import CallbackManager, TokenCountingHandler

handler = TokenCountingHandler(
            tokenizer=tiktoken.encoding_for_model('gpt-4o').encode,  # Fallback tokenizer
            verbose=True,
        )

llm = GoogleGenAI(
    model='gemini-1.5-flash',
    api_key='API_KEY_HERE',
    callback_manager=CallbackManager([handler]),
)

llm.complete('Answer with "Hello, World" in German')

print(handler.total_llm_token_count)  # Should be 13 found 32
print(handler.prompt_llm_token_count)  # Should be 9 found 22
print(handler.completion_llm_token_count)  # Should be 4 found 10
```

### Relevant Logs/Tracbacks

```shell
LLM Prompt Token Usage: 13
LLM Completion Token Usage: 6
LLM Prompt Token Usage: 9
LLM Completion Token Usage: 4
32
22
10
```

Labels: bug, triage
State: closed
[FEATURE] Add Amazon SageMaker as a provider

### Feature Area

Documentation

### Is your feature request related to a an existing bug? Please link it here.

NA

### Describe the solution you'd like

- Include SageMaker as a provider for LLMs with documented examples
- Include SageMaker into the cli that bootstraps a new crewAI project

### Describe alternatives you've considered

NA

### Additional context

NA

### Willingness to Contribute

Yes, I'd be happy to submit a pull request

Labels: feature-request
State: closed
[Feature Request]: Add sender and (optional) receiver to TerminationEvent

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

In my use case implementation, I am listening on `TerminationEvent` and then need to take some action depending on who sent the termination event. Mine is a system with multiple instances of `ConversableAgent` and the ability to distinguish between diff senders will help me accomplish this. 

I see that some events lke `PostCarryoverProcessingEvent` have these fields. IMO, the `sender` and `recipient` fields should be for all the events, but for the scope of this issue, I will restrict it to `TerminationEvent` only.



### Describe the solution you'd like

A termination Event defined as below would suffice


```python
class TerminationEvent(BaseEvent):
    """When a workflow termination condition is met"""

    termination_reason: str
    sender: ConversableAgent
    recipient: ConversableAgent
    

    def __init__(
        self,
        *,
        uuid: Optional[UUID] = None,
        sender: ConversableAgent,
        recipient: Optional[ConversableAgent] = None,
        termination_reason: str,
    ):
        super().__init__(
            uuid=uuid,
            termination_reason=termination_reason,
        )
```

### Additional context

_No response_

Labels: enhancement
State: closed
[Feature Request]: SearxNG search tool

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

Is your feature request related to a problem? Please describe.
SearxNG can be self-hosted and API Key-free

Describe the solution you'd like
Similar to the Wikipedia approach

Additional context
N/A

### Describe the solution you'd like

Similar to what I did for Tavily

### Additional context

_No response_

Labels: enhancement
State: closed
[Feature Request]: Make workflow visualizer work for FunctionAgent and AgentWorkflow-like agents

### Feature Description

It would be great to have the agent visualizer also work with tools/agent hand offs. So far it's designed to only show workflow steps and events. But, a lot of the time I'm seeing people use the pre-made agents like the AgentWorkflow and the FunctionAgent. It would be super cool if we can also show the tools that an agent has access to/agent hand-offs available etc.

### Reason

_No response_

### Value of Feature

_No response_

Labels: enhancement, triage
State: closed
[Feature Request]: DuckDB Vector Store Enhancements

### Feature Description

Hi, I'm interested in updating the DuckDB Vector Store integration.

I'd like to refactor it to:
1. Not re-initialize DuckDB from scratch for every query
2. Use the relational API instead of f-string to build SQL Queries
3. Add missing functionality like `get_nodes` and `delete_nodes`

Would ya'll be open to a PR to this effect?

### Reason

_No response_

### Value of Feature

_No response_

Labels: enhancement, triage
State: closed
[Bug]: Multiple Issues with `MistralAIMultiModal`

### Bug Description

I'm currently evaluating the use of Mistral Medium and spotted a few issues:
1. `llama-index-multi-modal-llms-mistralai` has a constraint on `llama-index-llms-mistralai>=0.4.0,<0.5"`
2. Image URL of type `pydantic.networks.AnyUrl` causes ValidationError
3. Azure AI Foundry API: Base64 encoded images are required to be packed into a `mistralai.models.imageurl.ImageURL`. I recon that this should be fixed on the side of Azure, as it makes little sense to have this structure:
```
{
    'image_url': {
         'url': 'data:image/png;base64,iVBORw0KGgo...',
    },
    'type': 'image_url'
}
```
instead of
```
{
    'image_url': 'data:image/png;base64,iVBORw0KGgo...',
    'type': 'image_url'
}
```
but nonetheless, it prevents us from accessing Azure deployments and both formats are supported by Mistrals Python SDK.

I might create a PR for these, but I'd appreciate some feedback on how you'd proceed with the third issue.

### Version

0.12.42

### Steps to Reproduce

```
from llama_index.multi_modal_llms.mistralai import MistralAIMultiModal
from llama_index.core.schema import ImageNode
import logging
logging.basicConfig()
logging.getLogger().setLevel(logging.DEBUG)

api_key = ""  # API key for mistral or alternative deployment
api_endpoint= None  # Only set if using an alternative deployment, e.g. Azure

mistralai_mm_llm = MistralAIMultiModal(
    model="mistral-medium-2505", api_key=api_key, endpoint=api_endpoint,
)


# Case 1: Providing a URL
image_document = ImageNode(image_url="https://tripfixers.com/wp-content/uploads/2019/11/eiffel-tower-with-snow.jpeg")
# Case 2: Providing a path (which the image will be loaded from and passed as B64 encoded string)
image_document = ImageNode(image_path=r"eiffel-tower-with-snow.jpeg")


complete_response = mistralai_mm_llm.complete(
    prompt="Describe the image as an alternative text in a few words",
    image_documents=[image_document],
)

print(complete_response)

### Relevant Logs/Tracbacks

```shell

```

Labels: bug, triage
State: closed
[Question]: Use of `system_prompt` parameter in `CodeAct` Agent

### Question Validation

- [x] I have searched both the documentation and discord for an answer.

### Question

In order to achieve Code Generation and execution feature for my `RagWorkflow`, I have been using the CodeAct agent provided by Llama Index here: https://docs.llamaindex.ai/en/stable/examples/agent/code_act_agent/

- I wanted to add some custom citation related prompts to the CodeAct agent.
- But as there are two different prompts available here: https://github.com/run-llama/llama_index/blob/main/llama-index-core/llama_index/core/agent/workflow/codeact_agent.py#L82-L113
- `code_act_system prompt` and `system_prompt`. I ended up adding the `system_prompt` and that had no effect and then later found out this `code_act_system prompt` is the actual prompt used in the code generation.
- The mention of different purpose and use of these two prompts would be helpful

Labels: question
State: closed
[Bug]: ReAct workflow ignores Action if no Thought is produced

### Bug Description

I was using a `ReActAgent` workflow when I received a response similar to the following:

```
To answer the question, I need to handoff to the research agent.

Action: handoff
Action Input: {"to_agent": "research", "reason": "**insert_any_reason_here**"}
```

Note the absence of `Thought:`, which is expected from the LLM in a ReAct agent.

Investigating a bit, I found out that the `ReActOutputParser` processes such a situation as follows:

```python
        if "Thought:" not in output:
            # NOTE: handle the case where the agent directly outputs the answer
            # instead of following the thought-answer format
            return ResponseReasoningStep(
                thought="(Implicit) I can answer without any more tools!",
                response=output,
                is_streaming=is_streaming,
            )

        # An "Action" should take priority over an "Answer"
        if "Action:" in output:
            return parse_action_reasoning_step(output)

        if "Answer:" in output:
            thought, answer = extract_final_response(output)
            return ResponseReasoningStep(
                thought=thought, response=answer, is_streaming=is_streaming
            )
```

which returns a `ResponseReasoningStep` object instead of a `ActionReasoningStep` needed to trigger function calling. Therefore, the Action function call is ignored and the whole response is treated as a final answer, including the Action and Action Inputs.

I think the first if statement should become:
```python
        if "Thought:" not in output and "Action:" not in output:
```
In addition, the `extract_tool_use` function should be updated to take into account the possibility of matching with no thought:
```python
def extract_tool_use(input_text: str) -> Tuple[str, str, str]:
    pattern = (
        r"(?:\s*Thought: (.*?)|(.+))\n+Action: ([^\n\(\) ]+)\n+Action Input: .*?(\{.*\})"
    )

    match = re.search(pattern, input_text, re.DOTALL)
    if not match:
        raise ValueError(f"Could not extract tool use from input text: {input_text}")

    thought = (match.group(1) or match.group(2)).strip()
    action = match.group(3).strip()
    action_input = match.group(4).strip()
    return thought, action, action_input
```


### Version

0.12.43

### Steps to Reproduce

I created a simple AgentWorkflow with a ReAct orchestrator agent and a ReAct research agent.
The issue occurs after several rounds of chat, probably due to the LLM context window filling up, making it ignore the system prompt specifying to always reply start with `Thought: `.

### Relevant Logs/Tracbacks

```shell

```

Labels: bug, triage
State: closed
[Bug]: MCP client fetch resources is not configuring the resources from MCP Server correctly

### Bug Description

The first bug is that in the function `to_tool_list_async` , when the resource function is being created, `resource.uri` should be passed not `resource.name`. Here:

```
fn = self._create_resource_fn(resource.name)
```

Second issue is that the fetch resources should also consider the resource templates (dynamic resources which allow parameters to be filled in the uri). Right now, the fetch_resources method only calls the `client.list_resources` and not `client.list_resource_templates` which it should and construct the uri in run time.

### Version

0.12.37

### Steps to Reproduce

Just create an MCP server with a resource. Set include_resources=True in llamaindex mcp client and connect to the server.

### Relevant Logs/Tracbacks

```shell

```

Labels: bug, triage
State: closed
[Documentation]: The environment variable used in azure openai llm sample is wrong

### Documentation Issue Description

On https://docs.llamaindex.ai/en/stable/examples/llm/azure_openai/#configure-environment-variables The document uses OPENAI_API_KEY as the environment variable for api key. However, the right way should use AZURE_OPENAI_API_KEY
```python
import os

os.environ["OPENAI_API_KEY"] = "<your-api-key>"
os.environ[
    "AZURE_OPENAI_ENDPOINT"
] = "https://<your-resource-name>.openai.azure.com/"
os.environ["OPENAI_API_VERSION"] = "2023-07-01-preview"
```

### Documentation Link

https://docs.llamaindex.ai/en/stable/examples/llm/azure_openai/#configure-environment-variables

Labels: triage
State: closed
[Bug]: claude 4 model not available in provider list

### Bug Description

Good day, 

Claude 4 has recently been released in the Ireland region in AWS on bed, please can the list of models be updated to support this new model release. 

Please can any inference application endpoints be update to work with claude4 if changes are needed. 

Thanks you, 

Please see code/ list here that needs to be extended to support v4 

https://github.com/run-llama/llama_index/blob/96b37a034f5a7e777af1d6575164364cf30577a0/llama-index-integrations/llms/llama-index-llms-anthropic/llama_index/llms/anthropic/utils.py#L33C1-L41C2

### Version

0.12.44

### Steps to Reproduce

Try to use claude 4 EU model with anthroptic llm class

### Relevant Logs/Tracbacks

```shell

```

Labels: bug, triage
State: closed
[Bug]: `generate_init_message` fails for multimodal model.

### Describe the bug

Note that the second method (in the bottom) does not work today, because of recent updates in generate_init_message

```python
image_agent = MultimodalConversableAgent(
    name="image-explainer",
    max_consecutive_auto_reply=10,
    llm_config={"config_list": config_list_4v, "temperature": 0.5, "max_tokens": 300},
)

user_proxy = autogen.UserProxyAgent(
    name="User_proxy",
    system_message="A human admin.",
    human_input_mode="NEVER",  # Try between ALWAYS or NEVER
    max_consecutive_auto_reply=0,
    code_execution_config={
        "use_docker": False
    },  # Please set use_docker=True if docker is available to run the generated code. Using docker is safer than running the generated code directly.
)

# Ask the question with an image
user_proxy.initiate_chat(
    image_agent,
    message="""What's the breed of this dog?
<img https://th.bing.com/th/id/R.422068ce8af4e15b0634fe2540adea7a?rik=y4OcXBE%2fqutDOw&pid=ImgRaw&r=0>.""",
)

# Equivalent
image_agent.clear_history()
user_proxy.initiate_chat(
    image_agent,
    message=[
        {
        "type": "text",
        "text": "What's the breed of this dog?"
        },
        {
        "type": "image_url",
        "image_url": {
            "url": get_pil_image("https://th.bing.com/th/id/R.422068ce8af4e15b0634fe2540adea7a?rik=y4OcXBE%2fqutDOw&pid=ImgRaw&r=0")
                },
        },
        {
        "type": "text",
        "text": "."
        },
    ]
)
```


Error message:
```
File ~/autogen/autogen/agentchat/conversable_agent.py:622, in ConversableAgent.send(self, message, recipient, request_reply, silent)
    620     recipient.receive(message, self, request_reply, silent)
    621 else:
--> 622     raise ValueError(
    623         "Message can't be converted into a valid ChatCompletion message. Either content or function_call must be provided."
    624     )

ValueError: Message can't be converted into a valid ChatCompletion message. Either content or function_call must be provided.
```

### Steps to reproduce

_No response_

### Model Used

_No response_

### Expected Behavior

_No response_

### Screenshots and logs

_No response_

### Additional Information

_No response_

State: closed
[Bug]: NVIDIA NIM API nemotron bug

### Bug Description

Hi, so I tried to use the NVIDIA NIM API (`llama-index-llms-nvidia`) with the [nemotron 49b model](https://build.nvidia.com/nvidia/llama-3_3-nemotron-super-49b-v1/modelcard). But I get a warning when loading it, and then an error when running it. I tried with the [nemotron ultra](https://build.nvidia.com/nvidia/llama-3_1-nemotron-ultra-253b-v1) model and it's the same. The API works well with [llama 3.3](https://build.nvidia.com/meta/llama-3_3-70b-instruct) though 

### Version

0.12.41

### Steps to Reproduce

- Python Version : 3.12.9

- `llama-index-llms-nvidia` : 0.3.4

```python
from llama_index.llms.nvidia import NVIDIA
# Load LLM using APIs
nemotron_super = NVIDIA(
    model="nvidia/llama-3.3-nemotron-super-49b-v1",
)
nemotron_super.complete("Hello this is a test")
```

### Relevant Logs/Tracbacks

```shell
.venv/lib/python3.12/site-packages/llama_index/llms/nvidia/base.py:163: UserWarning: Found nvidia/llama-3.3-nemotron-super-49b-v1 in available_models, but type is unknown and inference may fail.
  warnings.warn(

.venv/lib/python3.12/site-packages/pydantic/main.py:253, in BaseModel.__init__(self, **data)
    251 # `__tracebackhide__` tells pytest and some other tools to omit this function from tracebacks
    252 __tracebackhide__ = True
--> 253 validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
    254 if self is not validated_self:
    255     warnings.warn(
    256         'A custom validator is returning a value other than `self`.\n'
    257         "Returning anything other than `self` from a top level model validator isn't supported when validating via `__init__`.\n"
    258         'See the `model_validator` docs (https://docs.pydantic.dev/latest/concepts/validators/#model-validators) for more details.',
    259         stacklevel=2,
    260     )

ValidationError: 2 validation errors for LLMMetadata
is_chat_model
  Input should be a valid boolean [type=bool_type, input_value=None, input_type=NoneType]
    For further information visit https://errors.pydantic.dev/2.11/v/bool_type
is_function_calling_model
  Input should be a valid boolean [type=bool_type, input_value=None, input_type=NoneType]
    For further information visit https://errors.pydantic.dev/2.11/v/bool_type
```

Labels: bug, triage
State: closed
[Feature Request]: Expose Ollama "thinking" in FunctionAgent's AgentStream

### Feature Description

Ollama models now expose a `thinking` field in their streaming responses, providing insight into the model's intermediate reasoning steps. This was introduced in the [Ollama class here](https://github.com/run-llama/llama_index/blob/1e3af99d01343718b302bd81b9394593268a89da/llama-index-integrations/llms/llama-index-llms-ollama/llama_index/llms/ollama/base.py#L147).  

I am requesting that the `FunctionAgent` (specifically in [`function_agent.py`](https://github.com/run-llama/llama_index/blob/1e3af99d01343718b302bd81b9394593268a89da/llama-index-core/llama_index/core/agent/workflow/function_agent.py#L63-L71)) and the `AgentStream` class be updated to include the `thinking` field from the LLM response in the streamed events. This would allow downstream application and UI to display the model's "thinking" process in real time.

```python
ctx.write_event_to_stream(
    AgentStream(
        delta=last_chat_response.delta or "",
        response=last_chat_response.message.content or "",
        tool_calls=tool_calls or [],
        raw=raw,
        current_agent_name=self.name,
        thinking_delta=last_chat_response.additional_kwargs.get("thinking_delta", ""),
    )
)
```

### Reason

Currently, the `AgentStream` object does not include or expose the `thinking` field, even though it is available in the Ollama LLM response (`last_chat_response.additional_kwargs["thinking_delta"]`). As a result, there is no way for downstream application to display this information. Since LlamaIndex is a framework supporting multiple LLM providers, and not all providers expose a `thinking` field, this field is not currently part of the standard agent streaming interface.


### Value of Feature

Exposing the `thinking` field in `AgentStream` would enable developers to build interactive UIs that can show the model's intermediate reasoning ("thinking") as it streams, improving transparency and user experience. 

Labels: enhancement, triage
State: closed