pylance-release icon indicating copy to clipboard operation
pylance-release copied to clipboard

reportCallIssue : False error message.

Open marciomocellin opened this issue 7 months ago • 6 comments

Environment data

langchain-openai == 0.3.28

  • Pylance version: Pylance v2025.6.103 (pre-release)
  • OS and version: No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 24.04.2 LTS Release: 24.04 Codename: noble
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.12.3 (main, Jun 18 2025, 17:59:45) [GCC 13.3.0] on linux

Code Snippet

Image Image
XXX

Repro Steps

  1. XXX

Expected behavior

XXX

Actual behavior

XXX

Logs

XXX

marciomocellin avatar Jul 16 '25 16:07 marciomocellin

Hi @marciomocellin, I'm an AI Support assistant here to help with your issue. While the team reviews your request, I wanted to provide some possible tips and documentation that might help you in the meantime.

Similar Issues (FYI only, not solutions)

The following issues may or may not be related to your report. They are provided for reference only, as they may describe similar symptoms, affect the same feature, or address related concerns, but may not be the same issue.
  • Pylance 'reportCallIIssue' problems for "No parameter named…" false positive with Pydantic alias
    https://github.com/microsoft/pylance-release/issues/6554
  • Python Intellisense errors when instantiating AzureChatOpenAI/AzureOpenAI (missing/unknown parameters)
    https://github.com/microsoft/pylance-release/issues/4300

The team will respond to your issue shortly. Please note this is a trial feature and may not be fully accurate. I hope these suggestions are helpful in the meantime. If this comment helped you, please give it a 👍. If the suggestion was not helpful or was incorrect, please give it a 👎. Your feedback helps us improve!

github-actions[bot] avatar Jul 16 '25 16:07 github-actions[bot]

Pylance language server 2025.6.2 (pyright version 1.1.402, commit 9496ae00) starting

pylance_2025.6.2_id_0.txt pylance_2025.6.2_id_1.txt

marciomocellin avatar Jul 17 '25 20:07 marciomocellin

It would be helpful for us on reproing if you could include sample code that reproduces the problem? Screenshots can be hard to recreate.

rchiodo avatar Jul 17 '25 20:07 rchiodo

try 'api_key'

bschnurr avatar Jul 17 '25 20:07 bschnurr

@rchiodo httpx == 0.28.1

from langchain_openai import AzureChatOpenAI, AzureOpenAIEmbeddings
from httpx import Client

llm = AzureChatOpenAI(
    model=DEPLOYMENT_NAME,
    openai_api_version=OPENAI_API_VERSION,
    openai_api_key=config['OPENAI']['OPENAI_API_KEY'],
    base_url=f'{OPENAI_BASE_URL}/{DEPLOYMENT_NAME}',
    verbose=True,
    http_client=Client(verify=CERTIFICATE_PATH)
)

print(llm.invoke('Hello world.').content)

EMBEDDINGS_DEPLOYMENT_NAME='text-embedding-petrobras'
embeddings = AzureOpenAIEmbeddings(
    model=EMBEDDINGS_DEPLOYMENT_NAME,
    openai_api_version=OPENAI_API_VERSION,
    openai_api_key=config['OPENAI']['OPENAI_API_KEY'],
    base_url=f'{OPENAI_BASE_URL}/{EMBEDDINGS_DEPLOYMENT_NAME}',
    http_client=Client(verify=CERTIFICATE_PATH)
)
 
print(embeddings.embed_query('this is a test document'))

@bschnurr Your suggestion will work because of this:

openai_api_key: Optional[SecretStr] = Field(
    alias="api_key",
    default_factory=secret_from_env(
        ["AZURE_OPENAI_API_KEY", "OPENAI_API_KEY"], default=None
    ),
)

The alias parameter in Pydantic's Field is used to define an alternative name for a model attribute when parsing or exporting data. However the original name should be considered valid.

marciomocellin avatar Jul 18 '25 13:07 marciomocellin

oh interesting. so maybe there is some underlying issue with pydantic and us.

here is some more info https://github.com/pydantic/pydantic/issues/5893

bschnurr avatar Jul 18 '25 18:07 bschnurr