diff --git a/libs/oci/README.md b/libs/oci/README.md index 91b4069..76829a1 100644 --- a/libs/oci/README.md +++ b/libs/oci/README.md @@ -79,6 +79,53 @@ structured_llm = llm.with_structured_output(Joke) structured_llm.invoke("Tell me a joke about programming") ``` +### 5. Use OpenAI Responses API +`ChatOCIOpenAI` supports OpenAI Responses API. + +```python +from oci_openai import ( + OciSessionAuth, +) +from langchain_oci import ChatOCIOpenAI +client = ChatOCIOpenAI( + auth=OciSessionAuth(profile_name="MY_PROFILE_NAME"), + compartment_id="MY_COMPARTMENT_ID", + region="us-chicago-1", + model="openai.gpt-4.1", + conversation_store_id="MY_CONVERSATION_STORE_ID" + ) +messages = [ + ( + "system", + "You are a helpful translator. Translate the user sentence to French.", + ), + ("human", "I love programming."), + ] +response = client.invoke(messages) +``` +NOTE: By default `store` argument is set to `True` which requires passing `conversation_store_id`. You can set `store` to `False` and not pass `conversation_store_id`. +```python +from oci_openai import ( + OciSessionAuth, +) +from langchain_oci import ChatOCIOpenAI +client = ChatOCIOpenAI( + auth=OciSessionAuth(profile_name="MY_PROFILE_NAME"), + compartment_id="MY_COMPARTMENT_ID", + region="us-chicago-1", + model="openai.gpt-4.1", + store=False + ) +messages = [ + ( + "system", + "You are a helpful translator. Translate the user sentence to French.", + ), + ("human", "I love programming."), + ] +response = client.invoke(messages) +``` + ## OCI Data Science Model Deployment Examples diff --git a/libs/oci/examples/__init__.py b/libs/oci/examples/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/libs/oci/examples/chat_models/__init__.py b/libs/oci/examples/chat_models/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/libs/oci/examples/chat_models/langchain_oci_openai_responses_api_example.py b/libs/oci/examples/chat_models/langchain_oci_openai_responses_api_example.py new file mode 100644 index 0000000..ad43225 --- /dev/null +++ b/libs/oci/examples/chat_models/langchain_oci_openai_responses_api_example.py @@ -0,0 +1,118 @@ +from langchain_core.prompts import ChatPromptTemplate +from oci_openai import OciSessionAuth +from pydantic import BaseModel, Field +from rich import print + +from langchain_oci import ChatOCIOpenAI + +COMPARTMENT_ID = "ocid1.compartment.oc1..aaaaaaaaexample" +CONVERSATION_STORE_ID = ( + "ocid1.generativeaiconversationstore.oc1.us-chicago-1.aaaaaaaaexample" +) +SERVICE_ENDPOINT = "https://inference.generativeai.us-chicago-1.oci.oraclecloud.com" +REGION = "us-chicago-1" +MODEL = "openai.gpt-4o" +PROFILE_NAME = "oc1" + + +def get_oci_openai_client(): + return ChatOCIOpenAI( + auth=OciSessionAuth(profile_name=PROFILE_NAME), + compartment_id=COMPARTMENT_ID, + service_endpoint=SERVICE_ENDPOINT, + model=MODEL, + conversation_store_id=CONVERSATION_STORE_ID, + ) + + +def do_model_invoke(): + client = get_oci_openai_client() + messages = [ + ( + "system", + "You are a helpful translator. Translate the user sentence to French.", + ), + ("human", "I love programming."), + ] + response = client.invoke(messages) + return response + + +def do_prompt_chaining(): + client = get_oci_openai_client() + prompt = ChatPromptTemplate.from_messages( + [ + ( + "system", + "You are a helpful assistant that translates {input_language}" + " to {output_language}.", + ), + ("human", "{input}"), + ] + ) + + chain = prompt | client + response = chain.invoke( + { + "input_language": "English", + "output_language": "German", + "input": "I love programming.", + } + ) + return response + + +def do_function_calling(): + class GetWeather(BaseModel): + """Get the current weather in a given location""" + + location: str = Field( + ..., description="The city and state, e.g. San Francisco, CA" + ) + + client = get_oci_openai_client() + llm_with_tools = client.bind_tools([GetWeather]) + response = llm_with_tools.invoke( + "what is the weather like in San Francisco", + ) + return response + + +def do_web_search(): + client = get_oci_openai_client() + tool = {"type": "web_search"} + llm_with_tools = client.bind_tools([tool]) + + response = llm_with_tools.invoke("What was a positive news story from today?") + return response + + +def do_hosted_mcp_calling(): + client = get_oci_openai_client() + llm_with_mcp_tools = client.bind_tools( + [ + { + "type": "mcp", + "server_label": "deepwiki", + "server_url": "https://mcp.deepwiki.com/mcp", + "require_approval": "never", + } + ] + ) + response = llm_with_mcp_tools.invoke( + "What transport protocols does the 2025-03-26 version of the MCP " + "spec (modelcontextprotocol/modelcontextprotocol) support?" + ) + return response + + +def main(): + print(do_model_invoke()) + print(do_prompt_chaining()) + print(do_function_calling()) + print(do_web_search()) + print(do_hosted_mcp_calling()) + + +if __name__ == "__main__": + main() diff --git a/libs/oci/langchain_oci/__init__.py b/libs/oci/langchain_oci/__init__.py index eb6df32..b5a086c 100644 --- a/libs/oci/langchain_oci/__init__.py +++ b/libs/oci/langchain_oci/__init__.py @@ -6,7 +6,7 @@ ChatOCIModelDeploymentTGI, ChatOCIModelDeploymentVLLM, ) -from langchain_oci.chat_models.oci_generative_ai import ChatOCIGenAI +from langchain_oci.chat_models.oci_generative_ai import ChatOCIGenAI, ChatOCIOpenAI from langchain_oci.embeddings.oci_data_science_model_deployment_endpoint import ( OCIModelDeploymentEndpointEmbeddings, ) @@ -32,4 +32,5 @@ "OCIModelDeploymentLLM", "OCIModelDeploymentTGI", "OCIModelDeploymentVLLM", + "ChatOCIOpenAI", ] diff --git a/libs/oci/langchain_oci/chat_models/oci_generative_ai.py b/libs/oci/langchain_oci/chat_models/oci_generative_ai.py index 46945bc..1afca28 100644 --- a/libs/oci/langchain_oci/chat_models/oci_generative_ai.py +++ b/libs/oci/langchain_oci/chat_models/oci_generative_ai.py @@ -1,6 +1,6 @@ # Copyright (c) 2023 Oracle and/or its affiliates. # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/ - +import importlib import json import re import uuid @@ -21,6 +21,7 @@ Union, ) +import httpx from langchain_core.callbacks import CallbackManagerForLLMRun from langchain_core.language_models import LanguageModelInput from langchain_core.language_models.chat_models import ( @@ -50,12 +51,18 @@ from langchain_core.runnables import Runnable, RunnableMap, RunnablePassthrough from langchain_core.tools import BaseTool from langchain_core.utils.function_calling import convert_to_openai_function -from pydantic import BaseModel, ConfigDict +from langchain_openai import ChatOpenAI +from openai import DefaultHttpxClient +from pydantic import BaseModel, ConfigDict, SecretStr, model_validator from langchain_oci.llms.oci_generative_ai import OCIGenAIBase from langchain_oci.llms.utils import enforce_stop_tokens CUSTOM_ENDPOINT_PREFIX = "ocid1.generativeaiendpoint" +API_KEY = "" +COMPARTMENT_ID_HEADER = "opc-compartment-id" +CONVERSATION_STORE_ID_HEADER = "opc-conversation-store-id" +OUTPUT_VERSION = "responses/v1" # Mapping of JSON schema types to Python types JSON_TO_PYTHON_TYPES = { @@ -1463,3 +1470,184 @@ def _stream( ), generation_info=generation_info, ) + + +class ChatOCIOpenAI(ChatOpenAI): + """A custom OCI OpenAI client implementation conforming to OpenAI Responses API. + + Setup: + Install ``openai`` and ``langchain-openai``. + + .. code-block:: bash + + pip install -U openai langchain-openai langchain-oci + + Attributes: + auth (httpx.Auth): Authentication handler for OCI request signing. + compartment_id (str): OCI compartment ID for resource isolation + model (str): Name of OpenAI model to use. + conversation_store_id (str | None): Conversation Store Id to use + when generating responses. + Must be provided if store is set to False + region (str | None): The OCI service region, e.g., 'us-chicago-1'. + Must be provided if service_endpoint and base_url are None + service_endpoint (str | None): The OCI service endpoint. when service_endpoint + is provided, the region will be ignored. + base_url (str | None): The OCI service full path URL. + when base_url is provided, the region + and service_endpoint will be ignored. + + Instantiate: + .. code-block:: python + + from oci_openai import OciResourcePrincipalAuth + from langchain_oci import ChatOCIOpenAI + + client = ChatOCIOpenAI( + auth=OciResourcePrincipalAuth(), + compartment_id=COMPARTMENT_ID, + region="us-chicago-1", + model=MODEL, + conversation_store_id=CONVERSATION_STORE_ID, + ) + + Invoke: + .. code-block:: python + + messages = [ + ( + "system", + "You are a helpful translator. Translate the user + sentence to French.", + ), + ("human", "I love programming."), + ] + response = client.invoke(messages) + + Prompt Chaining: + .. code-block:: python + + prompt = ChatPromptTemplate.from_messages( + [ + ( + "system", + "You are a helpful assistant that translates + {input_language} to {output_language}.", + ), + ("human", "{input}"), + ] + ) + chain = prompt | client + response = chain.invoke( + { + "input_language": "English", + "output_language": "German", + "input": "I love programming.", + } + ) + + Function Calling: + .. code-block:: python + + class GetWeather(BaseModel): + location: str = Field( + ..., description="The city and state, e.g. San Francisco, CA" + ) + + + llm_with_tools = client.bind_tools([GetWeather]) + ai_msg = llm_with_tools.invoke( + "what is the weather like in San Francisco", + ) + response = ai_msg.tool_calls + + Web Search: + .. code-block:: python + + tool = {"type": "web_search_preview"} + llm_with_tools = client.bind_tools([tool]) + response = llm_with_tools.invoke("What was a + positive news story from today?") + + Hosted MCP Calling: + .. code-block:: python + + llm_with_mcp_tools = client.bind_tools( + [ + { + "type": "mcp", + "server_label": "deepwiki", + "server_url": "https://mcp.deepwiki.com/mcp", + "require_approval": "never", + } + ] + ) + response = llm_with_mcp_tools.invoke( + "What transport protocols does the 2025-03-26 version of the MCP " + "spec (modelcontextprotocol/modelcontextprotocol) support?" + ) + """ + + @model_validator(mode="before") + @classmethod + def validate_openai(cls, values: Any) -> Any: + """Checks if langchain_openai is installed.""" + if not importlib.util.find_spec("langchain_openai"): + raise ImportError( + "Could not import langchain_openai package. " + "Please install it with `pip install langchain_openai`." + ) + return values + + def __init__( + self, + auth: httpx.Auth, + compartment_id: str, + model: str, + conversation_store_id: Optional[str] = None, + region: Optional[str] = None, + service_endpoint: Optional[str] = None, + base_url: Optional[str] = None, + **kwargs: Any, + ): + try: + from oci_openai.oci_openai import _resolve_base_url + except ImportError as e: + raise ImportError( + "Could not import _resolve_base_url. " + "Please install: pip install oci-openai" + ) from e + + super().__init__( + model=model, + api_key=SecretStr(API_KEY), + http_client=DefaultHttpxClient( + auth=auth, + headers=_build_headers( + compartment_id=compartment_id, + conversation_store_id=conversation_store_id, + **kwargs, + ), + ), + base_url=_resolve_base_url( + region=region, service_endpoint=service_endpoint, base_url=base_url + ), + use_responses_api=True, + output_version=OUTPUT_VERSION, + **kwargs, + ) + + +def _build_headers(compartment_id, conversation_store_id=None, **kwargs): + store = kwargs.get("store", True) + + headers = {COMPARTMENT_ID_HEADER: compartment_id} + + if store: + if conversation_store_id is None: + raise ValueError( + "Conversation Store Id must be provided when store is set to True" + ) + headers[CONVERSATION_STORE_ID_HEADER] = conversation_store_id + + return headers diff --git a/libs/oci/poetry.lock b/libs/oci/poetry.lock index c9635db..54f5896 100644 --- a/libs/oci/poetry.lock +++ b/libs/oci/poetry.lock @@ -498,12 +498,12 @@ version = "0.4.6" description = "Cross-platform colored terminal text." optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" -groups = ["test"] -markers = "sys_platform == \"win32\"" +groups = ["main", "test"] files = [ {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, ] +markers = {main = "platform_system == \"Windows\"", test = "platform_system == \"Windows\" or sys_platform == \"win32\""} [[package]] name = "coverage" @@ -847,6 +847,18 @@ ssh = ["bcrypt (>=3.1.5)"] test = ["certifi (>=2024)", "cryptography-vectors (==45.0.7)", "pretend (>=0.7)", "pytest (>=7.4.0)", "pytest-benchmark (>=4.0)", "pytest-cov (>=2.10.1)", "pytest-xdist (>=3.5.0)"] test-randomorder = ["pytest-randomly"] +[[package]] +name = "distro" +version = "1.9.0" +description = "Distro - an OS platform information API" +optional = false +python-versions = ">=3.6" +groups = ["main", "test"] +files = [ + {file = "distro-1.9.0-py3-none-any.whl", hash = "sha256:7bffd925d65168f85027d8da9af6bddab658135b840670a223589bc0c8ef02b2"}, + {file = "distro-1.9.0.tar.gz", hash = "sha256:2fa77c6fd8940f116ee1d6b94a2f90b13b5ea8d019b98bc8bafdcabcdd9bdbed"}, +] + [[package]] name = "exceptiongroup" version = "1.3.0" @@ -1123,14 +1135,14 @@ trio = ["trio (>=0.22.0,<1.0)"] [[package]] name = "httpx" -version = "0.28.1" +version = "0.26.0" description = "The next generation HTTP client." optional = false python-versions = ">=3.8" groups = ["main", "test", "test-integration"] files = [ - {file = "httpx-0.28.1-py3-none-any.whl", hash = "sha256:d909fcccc110f8c7faf814ca82a9a4d816bc5a6dbfea25d6591d6985b8ba59ad"}, - {file = "httpx-0.28.1.tar.gz", hash = "sha256:75e98c5f16b0f35b567856f597f06ff2270a374470a5c2392242528e3e3e42fc"}, + {file = "httpx-0.26.0-py3-none-any.whl", hash = "sha256:8915f5a3627c4d47b73e8202457cb28f1266982d1159bd5779d86a80c0eab1cd"}, + {file = "httpx-0.26.0.tar.gz", hash = "sha256:451b55c30d5185ea6b23c2c793abf9bb237d2a7dfb901ced6ff69ad37ec1dfaf"}, ] [package.dependencies] @@ -1138,13 +1150,13 @@ anyio = "*" certifi = "*" httpcore = "==1.*" idna = "*" +sniffio = "*" [package.extras] brotli = ["brotli ; platform_python_implementation == \"CPython\"", "brotlicffi ; platform_python_implementation != \"CPython\""] cli = ["click (==8.*)", "pygments (==2.*)", "rich (>=10,<14)"] http2 = ["h2 (>=3,<5)"] socks = ["socksio (==1.*)"] -zstd = ["zstandard (>=0.18.0)"] [[package]] name = "idna" @@ -1212,6 +1224,118 @@ files = [ {file = "iniconfig-2.3.0.tar.gz", hash = "sha256:c76315c77db068650d49c5b56314774a7804df16fee4402c1f19d6d15d8c4730"}, ] +[[package]] +name = "jiter" +version = "0.12.0" +description = "Fast iterable JSON parser." +optional = false +python-versions = ">=3.9" +groups = ["main", "test"] +files = [ + {file = "jiter-0.12.0-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:e7acbaba9703d5de82a2c98ae6a0f59ab9770ab5af5fa35e43a303aee962cf65"}, + {file = "jiter-0.12.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:364f1a7294c91281260364222f535bc427f56d4de1d8ffd718162d21fbbd602e"}, + {file = "jiter-0.12.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:85ee4d25805d4fb23f0a5167a962ef8e002dbfb29c0989378488e32cf2744b62"}, + {file = "jiter-0.12.0-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:796f466b7942107eb889c08433b6e31b9a7ed31daceaecf8af1be26fb26c0ca8"}, + {file = "jiter-0.12.0-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:35506cb71f47dba416694e67af996bbdefb8e3608f1f78799c2e1f9058b01ceb"}, + {file = "jiter-0.12.0-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:726c764a90c9218ec9e4f99a33d6bf5ec169163f2ca0fc21b654e88c2abc0abc"}, + {file = "jiter-0.12.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:baa47810c5565274810b726b0dc86d18dce5fd17b190ebdc3890851d7b2a0e74"}, + {file = "jiter-0.12.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:f8ec0259d3f26c62aed4d73b198c53e316ae11f0f69c8fbe6682c6dcfa0fcce2"}, + {file = "jiter-0.12.0-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:79307d74ea83465b0152fa23e5e297149506435535282f979f18b9033c0bb025"}, + {file = "jiter-0.12.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:cf6e6dd18927121fec86739f1a8906944703941d000f0639f3eb6281cc601dca"}, + {file = "jiter-0.12.0-cp310-cp310-win32.whl", hash = "sha256:b6ae2aec8217327d872cbfb2c1694489057b9433afce447955763e6ab015b4c4"}, + {file = "jiter-0.12.0-cp310-cp310-win_amd64.whl", hash = "sha256:c7f49ce90a71e44f7e1aa9e7ec415b9686bbc6a5961e57eab511015e6759bc11"}, + {file = "jiter-0.12.0-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:d8f8a7e317190b2c2d60eb2e8aa835270b008139562d70fe732e1c0020ec53c9"}, + {file = "jiter-0.12.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:2218228a077e784c6c8f1a8e5d6b8cb1dea62ce25811c356364848554b2056cd"}, + {file = "jiter-0.12.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9354ccaa2982bf2188fd5f57f79f800ef622ec67beb8329903abf6b10da7d423"}, + {file = "jiter-0.12.0-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:8f2607185ea89b4af9a604d4c7ec40e45d3ad03ee66998b031134bc510232bb7"}, + {file = "jiter-0.12.0-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3a585a5e42d25f2e71db5f10b171f5e5ea641d3aa44f7df745aa965606111cc2"}, + {file = "jiter-0.12.0-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:bd9e21d34edff5a663c631f850edcb786719c960ce887a5661e9c828a53a95d9"}, + {file = "jiter-0.12.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4a612534770470686cd5431478dc5a1b660eceb410abade6b1b74e320ca98de6"}, + {file = "jiter-0.12.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:3985aea37d40a908f887b34d05111e0aae822943796ebf8338877fee2ab67725"}, + {file = "jiter-0.12.0-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:b1207af186495f48f72529f8d86671903c8c10127cac6381b11dddc4aaa52df6"}, + {file = "jiter-0.12.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:ef2fb241de583934c9915a33120ecc06d94aa3381a134570f59eed784e87001e"}, + {file = "jiter-0.12.0-cp311-cp311-win32.whl", hash = "sha256:453b6035672fecce8007465896a25b28a6b59cfe8fbc974b2563a92f5a92a67c"}, + {file = "jiter-0.12.0-cp311-cp311-win_amd64.whl", hash = "sha256:ca264b9603973c2ad9435c71a8ec8b49f8f715ab5ba421c85a51cde9887e421f"}, + {file = "jiter-0.12.0-cp311-cp311-win_arm64.whl", hash = "sha256:cb00ef392e7d684f2754598c02c409f376ddcef857aae796d559e6cacc2d78a5"}, + {file = "jiter-0.12.0-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:305e061fa82f4680607a775b2e8e0bcb071cd2205ac38e6ef48c8dd5ebe1cf37"}, + {file = "jiter-0.12.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:5c1860627048e302a528333c9307c818c547f214d8659b0705d2195e1a94b274"}, + {file = "jiter-0.12.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:df37577a4f8408f7e0ec3205d2a8f87672af8f17008358063a4d6425b6081ce3"}, + {file = "jiter-0.12.0-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:75fdd787356c1c13a4f40b43c2156276ef7a71eb487d98472476476d803fb2cf"}, + {file = "jiter-0.12.0-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1eb5db8d9c65b112aacf14fcd0faae9913d07a8afea5ed06ccdd12b724e966a1"}, + {file = "jiter-0.12.0-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:73c568cc27c473f82480abc15d1301adf333a7ea4f2e813d6a2c7d8b6ba8d0df"}, + {file = "jiter-0.12.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4321e8a3d868919bcb1abb1db550d41f2b5b326f72df29e53b2df8b006eb9403"}, + {file = "jiter-0.12.0-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:0a51bad79f8cc9cac2b4b705039f814049142e0050f30d91695a2d9a6611f126"}, + {file = "jiter-0.12.0-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:2a67b678f6a5f1dd6c36d642d7db83e456bc8b104788262aaefc11a22339f5a9"}, + {file = "jiter-0.12.0-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:efe1a211fe1fd14762adea941e3cfd6c611a136e28da6c39272dbb7a1bbe6a86"}, + {file = "jiter-0.12.0-cp312-cp312-win32.whl", hash = "sha256:d779d97c834b4278276ec703dc3fc1735fca50af63eb7262f05bdb4e62203d44"}, + {file = "jiter-0.12.0-cp312-cp312-win_amd64.whl", hash = "sha256:e8269062060212b373316fe69236096aaf4c49022d267c6736eebd66bbbc60bb"}, + {file = "jiter-0.12.0-cp312-cp312-win_arm64.whl", hash = "sha256:06cb970936c65de926d648af0ed3d21857f026b1cf5525cb2947aa5e01e05789"}, + {file = "jiter-0.12.0-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:6cc49d5130a14b732e0612bc76ae8db3b49898732223ef8b7599aa8d9810683e"}, + {file = "jiter-0.12.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:37f27a32ce36364d2fa4f7fdc507279db604d27d239ea2e044c8f148410defe1"}, + {file = "jiter-0.12.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bbc0944aa3d4b4773e348cda635252824a78f4ba44328e042ef1ff3f6080d1cf"}, + {file = "jiter-0.12.0-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:da25c62d4ee1ffbacb97fac6dfe4dcd6759ebdc9015991e92a6eae5816287f44"}, + {file = "jiter-0.12.0-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:048485c654b838140b007390b8182ba9774621103bd4d77c9c3f6f117474ba45"}, + {file = "jiter-0.12.0-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:635e737fbb7315bef0037c19b88b799143d2d7d3507e61a76751025226b3ac87"}, + {file = "jiter-0.12.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4e017c417b1ebda911bd13b1e40612704b1f5420e30695112efdbed8a4b389ed"}, + {file = "jiter-0.12.0-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:89b0bfb8b2bf2351fba36bb211ef8bfceba73ef58e7f0c68fb67b5a2795ca2f9"}, + {file = "jiter-0.12.0-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:f5aa5427a629a824a543672778c9ce0c5e556550d1569bb6ea28a85015287626"}, + {file = "jiter-0.12.0-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:ed53b3d6acbcb0fd0b90f20c7cb3b24c357fe82a3518934d4edfa8c6898e498c"}, + {file = "jiter-0.12.0-cp313-cp313-win32.whl", hash = "sha256:4747de73d6b8c78f2e253a2787930f4fffc68da7fa319739f57437f95963c4de"}, + {file = "jiter-0.12.0-cp313-cp313-win_amd64.whl", hash = "sha256:e25012eb0c456fcc13354255d0338cd5397cce26c77b2832b3c4e2e255ea5d9a"}, + {file = "jiter-0.12.0-cp313-cp313-win_arm64.whl", hash = "sha256:c97b92c54fe6110138c872add030a1f99aea2401ddcdaa21edf74705a646dd60"}, + {file = "jiter-0.12.0-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:53839b35a38f56b8be26a7851a48b89bc47e5d88e900929df10ed93b95fea3d6"}, + {file = "jiter-0.12.0-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:94f669548e55c91ab47fef8bddd9c954dab1938644e715ea49d7e117015110a4"}, + {file = "jiter-0.12.0-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:351d54f2b09a41600ffea43d081522d792e81dcfb915f6d2d242744c1cc48beb"}, + {file = "jiter-0.12.0-cp313-cp313t-win_amd64.whl", hash = "sha256:2a5e90604620f94bf62264e7c2c038704d38217b7465b863896c6d7c902b06c7"}, + {file = "jiter-0.12.0-cp313-cp313t-win_arm64.whl", hash = "sha256:88ef757017e78d2860f96250f9393b7b577b06a956ad102c29c8237554380db3"}, + {file = "jiter-0.12.0-cp314-cp314-macosx_10_12_x86_64.whl", hash = "sha256:c46d927acd09c67a9fb1416df45c5a04c27e83aae969267e98fba35b74e99525"}, + {file = "jiter-0.12.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:774ff60b27a84a85b27b88cd5583899c59940bcc126caca97eb2a9df6aa00c49"}, + {file = "jiter-0.12.0-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c5433fab222fb072237df3f637d01b81f040a07dcac1cb4a5c75c7aa9ed0bef1"}, + {file = "jiter-0.12.0-cp314-cp314-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:f8c593c6e71c07866ec6bfb790e202a833eeec885022296aff6b9e0b92d6a70e"}, + {file = "jiter-0.12.0-cp314-cp314-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:90d32894d4c6877a87ae00c6b915b609406819dce8bc0d4e962e4de2784e567e"}, + {file = "jiter-0.12.0-cp314-cp314-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:798e46eed9eb10c3adbbacbd3bdb5ecd4cf7064e453d00dbef08802dae6937ff"}, + {file = "jiter-0.12.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b3f1368f0a6719ea80013a4eb90ba72e75d7ea67cfc7846db2ca504f3df0169a"}, + {file = "jiter-0.12.0-cp314-cp314-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:65f04a9d0b4406f7e51279710b27484af411896246200e461d80d3ba0caa901a"}, + {file = "jiter-0.12.0-cp314-cp314-musllinux_1_1_aarch64.whl", hash = "sha256:fd990541982a24281d12b67a335e44f117e4c6cbad3c3b75c7dea68bf4ce3a67"}, + {file = "jiter-0.12.0-cp314-cp314-musllinux_1_1_x86_64.whl", hash = "sha256:b111b0e9152fa7df870ecaebb0bd30240d9f7fff1f2003bcb4ed0f519941820b"}, + {file = "jiter-0.12.0-cp314-cp314-win32.whl", hash = "sha256:a78befb9cc0a45b5a5a0d537b06f8544c2ebb60d19d02c41ff15da28a9e22d42"}, + {file = "jiter-0.12.0-cp314-cp314-win_amd64.whl", hash = "sha256:e1fe01c082f6aafbe5c8faf0ff074f38dfb911d53f07ec333ca03f8f6226debf"}, + {file = "jiter-0.12.0-cp314-cp314-win_arm64.whl", hash = "sha256:d72f3b5a432a4c546ea4bedc84cce0c3404874f1d1676260b9c7f048a9855451"}, + {file = "jiter-0.12.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:e6ded41aeba3603f9728ed2b6196e4df875348ab97b28fc8afff115ed42ba7a7"}, + {file = "jiter-0.12.0-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a947920902420a6ada6ad51892082521978e9dd44a802663b001436e4b771684"}, + {file = "jiter-0.12.0-cp314-cp314t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:add5e227e0554d3a52cf390a7635edaffdf4f8fce4fdbcef3cc2055bb396a30c"}, + {file = "jiter-0.12.0-cp314-cp314t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3f9b1cda8fcb736250d7e8711d4580ebf004a46771432be0ae4796944b5dfa5d"}, + {file = "jiter-0.12.0-cp314-cp314t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:deeb12a2223fe0135c7ff1356a143d57f95bbf1f4a66584f1fc74df21d86b993"}, + {file = "jiter-0.12.0-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c596cc0f4cb574877550ce4ecd51f8037469146addd676d7c1a30ebe6391923f"}, + {file = "jiter-0.12.0-cp314-cp314t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:5ab4c823b216a4aeab3fdbf579c5843165756bd9ad87cc6b1c65919c4715f783"}, + {file = "jiter-0.12.0-cp314-cp314t-musllinux_1_1_aarch64.whl", hash = "sha256:e427eee51149edf962203ff8db75a7514ab89be5cb623fb9cea1f20b54f1107b"}, + {file = "jiter-0.12.0-cp314-cp314t-musllinux_1_1_x86_64.whl", hash = "sha256:edb868841f84c111255ba5e80339d386d937ec1fdce419518ce1bd9370fac5b6"}, + {file = "jiter-0.12.0-cp314-cp314t-win32.whl", hash = "sha256:8bbcfe2791dfdb7c5e48baf646d37a6a3dcb5a97a032017741dea9f817dca183"}, + {file = "jiter-0.12.0-cp314-cp314t-win_amd64.whl", hash = "sha256:2fa940963bf02e1d8226027ef461e36af472dea85d36054ff835aeed944dd873"}, + {file = "jiter-0.12.0-cp314-cp314t-win_arm64.whl", hash = "sha256:506c9708dd29b27288f9f8f1140c3cb0e3d8ddb045956d7757b1fa0e0f39a473"}, + {file = "jiter-0.12.0-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:c9d28b218d5f9e5f69a0787a196322a5056540cb378cac8ff542b4fa7219966c"}, + {file = "jiter-0.12.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:d0ee12028daf8cfcf880dd492349a122a64f42c059b6c62a2b0c96a83a8da820"}, + {file = "jiter-0.12.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1b135ebe757a82d67ed2821526e72d0acf87dd61f6013e20d3c45b8048af927b"}, + {file = "jiter-0.12.0-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:15d7fafb81af8a9e3039fc305529a61cd933eecee33b4251878a1c89859552a3"}, + {file = "jiter-0.12.0-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:92d1f41211d8a8fe412faad962d424d334764c01dac6691c44691c2e4d3eedaf"}, + {file = "jiter-0.12.0-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3a64a48d7c917b8f32f25c176df8749ecf08cec17c466114727efe7441e17f6d"}, + {file = "jiter-0.12.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:122046f3b3710b85de99d9aa2f3f0492a8233a2f54a64902b096efc27ea747b5"}, + {file = "jiter-0.12.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:27ec39225e03c32c6b863ba879deb427882f243ae46f0d82d68b695fa5b48b40"}, + {file = "jiter-0.12.0-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:26b9e155ddc132225a39b1995b3b9f0fe0f79a6d5cbbeacf103271e7d309b404"}, + {file = "jiter-0.12.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:9ab05b7c58e29bb9e60b70c2e0094c98df79a1e42e397b9bb6eaa989b7a66dd0"}, + {file = "jiter-0.12.0-cp39-cp39-win32.whl", hash = "sha256:59f9f9df87ed499136db1c2b6c9efb902f964bed42a582ab7af413b6a293e7b0"}, + {file = "jiter-0.12.0-cp39-cp39-win_amd64.whl", hash = "sha256:d3719596a1ebe7a48a498e8d5d0c4bf7553321d4c3eee1d620628d51351a3928"}, + {file = "jiter-0.12.0-graalpy311-graalpy242_311_native-macosx_10_12_x86_64.whl", hash = "sha256:4739a4657179ebf08f85914ce50332495811004cc1747852e8b2041ed2aab9b8"}, + {file = "jiter-0.12.0-graalpy311-graalpy242_311_native-macosx_11_0_arm64.whl", hash = "sha256:41da8def934bf7bec16cb24bd33c0ca62126d2d45d81d17b864bd5ad721393c3"}, + {file = "jiter-0.12.0-graalpy311-graalpy242_311_native-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9c44ee814f499c082e69872d426b624987dbc5943ab06e9bbaa4f81989fdb79e"}, + {file = "jiter-0.12.0-graalpy311-graalpy242_311_native-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:cd2097de91cf03eaa27b3cbdb969addf83f0179c6afc41bbc4513705e013c65d"}, + {file = "jiter-0.12.0-graalpy312-graalpy250_312_native-macosx_10_12_x86_64.whl", hash = "sha256:e8547883d7b96ef2e5fe22b88f8a4c8725a56e7f4abafff20fd5272d634c7ecb"}, + {file = "jiter-0.12.0-graalpy312-graalpy250_312_native-macosx_11_0_arm64.whl", hash = "sha256:89163163c0934854a668ed783a2546a0617f71706a2551a4a0666d91ab365d6b"}, + {file = "jiter-0.12.0-graalpy312-graalpy250_312_native-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d96b264ab7d34bbb2312dedc47ce07cd53f06835eacbc16dde3761f47c3a9e7f"}, + {file = "jiter-0.12.0-graalpy312-graalpy250_312_native-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c24e864cb30ab82311c6425655b0cdab0a98c5d973b065c66a3f020740c2324c"}, + {file = "jiter-0.12.0.tar.gz", hash = "sha256:64dfcd7d5c168b38d3f9f8bba7fc639edb3418abcc74f22fdbe6b8938293f30b"}, +] + [[package]] name = "jsonpatch" version = "1.33" @@ -1301,33 +1425,50 @@ PyYAML = ">=5.3.0,<7.0.0" tenacity = ">=8.1.0,<8.4.0 || >8.4.0,<10.0.0" typing-extensions = ">=4.7.0,<5.0.0" +[[package]] +name = "langchain-openai" +version = "0.3.35" +description = "An integration package connecting OpenAI and LangChain" +optional = false +python-versions = "<4.0.0,>=3.9.0" +groups = ["main", "test"] +files = [ + {file = "langchain_openai-0.3.35-py3-none-any.whl", hash = "sha256:76d5707e6e81fd461d33964ad618bd326cb661a1975cef7c1cb0703576bdada5"}, + {file = "langchain_openai-0.3.35.tar.gz", hash = "sha256:fa985fd041c3809da256a040c98e8a43e91c6d165b96dcfeb770d8bd457bf76f"}, +] + +[package.dependencies] +langchain-core = ">=0.3.78,<1.0.0" +openai = ">=1.104.2,<3.0.0" +tiktoken = ">=0.7.0,<1.0.0" + [[package]] name = "langchain-tests" -version = "0.3.22" +version = "0.3.20" description = "Standard tests for LangChain implementations" optional = false -python-versions = "<4.0.0,>=3.9.0" +python-versions = ">=3.9" groups = ["test"] files = [ - {file = "langchain_tests-0.3.22-py3-none-any.whl", hash = "sha256:b38173666236740343432ca1619fc7f742657649ff9e237ac89db5be921ee819"}, - {file = "langchain_tests-0.3.22.tar.gz", hash = "sha256:f4a57e5fdd9d4b0b30b7525f64cfaf959dc62f44b6825427abcce6bbbc83db72"}, + {file = "langchain_tests-0.3.20-py3-none-any.whl", hash = "sha256:6cc7ae64eb8dea65360a968840abe8d947c5382b95e065431c9dd061ee1dacd8"}, + {file = "langchain_tests-0.3.20.tar.gz", hash = "sha256:b94c05e37d191d4768a1a5064f2ca4053bacd48ff41e10af245ffa6a065ead4d"}, ] [package.dependencies] -httpx = ">=0.28.1,<1.0.0" -langchain-core = ">=0.3.77,<2.0.0" +httpx = ">=0.25.0,<1" +langchain-core = ">=0.3.63,<1.0.0" numpy = [ {version = ">=1.26.2", markers = "python_version < \"3.13\""}, {version = ">=2.1.0", markers = "python_version >= \"3.13\""}, ] -pytest = ">=7.0.0,<9.0.0" -pytest-asyncio = ">=0.20.0,<2.0.0" +pytest = ">=7,<9" +pytest-asyncio = ">=0.20,<1" pytest-benchmark = "*" pytest-codspeed = "*" pytest-recording = "*" -pytest-socket = ">=0.7.0,<1.0.0" -syrupy = ">=4.0.0,<5.0.0" -vcrpy = ">=7.0.0,<8.0.0" +pytest-socket = ">=0.6.0,<1" +syrupy = ">=4,<5" +vcrpy = ">=7.0" [[package]] name = "langchain-text-splitters" @@ -1350,7 +1491,7 @@ version = "0.2.76" description = "Building stateful, multi-actor applications with LLMs" optional = false python-versions = "<4.0,>=3.9.0" -groups = ["test-integration"] +groups = ["test", "test-integration"] files = [ {file = "langgraph-0.2.76-py3-none-any.whl", hash = "sha256:076b8b5d2fc5a9761c46a7618430cfa5c978a8012257c43cbc127b27e0fd7872"}, {file = "langgraph-0.2.76.tar.gz", hash = "sha256:688f8dcd9b6797ba78384599e0de944773000c75156ad1e186490e99e89fa5c0"}, @@ -1367,7 +1508,7 @@ version = "2.1.2" description = "Library with base interfaces for LangGraph checkpoint savers." optional = false python-versions = ">=3.9" -groups = ["test-integration"] +groups = ["test", "test-integration"] files = [ {file = "langgraph_checkpoint-2.1.2-py3-none-any.whl", hash = "sha256:911ebffb069fd01775d4b5184c04aaafc2962fcdf50cf49d524cd4367c4d0c60"}, {file = "langgraph_checkpoint-2.1.2.tar.gz", hash = "sha256:112e9d067a6eff8937caf198421b1ffba8d9207193f14ac6f89930c1260c06f9"}, @@ -1383,7 +1524,7 @@ version = "0.1.74" description = "SDK for interacting with LangGraph API" optional = false python-versions = ">=3.9" -groups = ["test-integration"] +groups = ["test", "test-integration"] files = [ {file = "langgraph_sdk-0.1.74-py3-none-any.whl", hash = "sha256:3a265c3757fe0048adad4391d10486db63ef7aa5a2cbd22da22d4503554cb890"}, {file = "langgraph_sdk-0.1.74.tar.gz", hash = "sha256:7450e0db5b226cc2e5328ca22c5968725873630ef47c4206a30707cb25dc3ad6"}, @@ -1978,6 +2119,55 @@ pytz = ">=2016.10" [package.extras] adk = ["docstring-parser (>=0.16) ; python_version >= \"3.10\" and python_version < \"4\"", "mcp (>=1.6.0) ; python_version >= \"3.10\" and python_version < \"4\"", "pydantic (>=2.10.6) ; python_version >= \"3.10\" and python_version < \"4\"", "rich (>=13.9.4) ; python_version >= \"3.10\" and python_version < \"4\""] +[[package]] +name = "oci-openai" +version = "1.0.0" +description = "OCI authentication and authorization utilities for OpenAI python SDK" +optional = false +python-versions = ">=3.9" +groups = ["main"] +files = [ + {file = "oci_openai-1.0.0-py3-none-any.whl", hash = "sha256:7fc3b464c7f995b789729755e117a3d0cf911118a0a4f7d313fa57c1bd5f9853"}, + {file = "oci_openai-1.0.0.tar.gz", hash = "sha256:328836457b0c14306083ea865be2397ee1e0e0a846fe296b0be9c552361546df"}, +] + +[package.dependencies] +httpx = ">=0.23.0,<1" +oci = ">=2.150.1" +openai = ">=v1.108.1" +requests = ">=2.32.1,<3.0.0" + +[package.extras] +dev = ["ag2[openai]", "black (>=24.8.0,<25.0.0)", "isort (>=5.13.2,<6.0.0)", "mypy (>=1.11.1,<2.0.0)", "openai-agents (>=0.5.1)", "pytest (>=8.3.2,<9.0.0)", "pytest-asyncio", "pytest-cov (>=5.0.0,<6.0.0)", "pytest-httpx", "pytest-mock", "respx", "ruff (>=0.5.6,<0.6.0)", "typing-extensions (>=4.11,<5)"] + +[[package]] +name = "openai" +version = "2.8.1" +description = "The official Python library for the openai API" +optional = false +python-versions = ">=3.9" +groups = ["main", "test"] +files = [ + {file = "openai-2.8.1-py3-none-any.whl", hash = "sha256:c6c3b5a04994734386e8dad3c00a393f56d3b68a27cd2e8acae91a59e4122463"}, + {file = "openai-2.8.1.tar.gz", hash = "sha256:cb1b79eef6e809f6da326a7ef6038719e35aa944c42d081807bfa1be8060f15f"}, +] + +[package.dependencies] +anyio = ">=3.5.0,<5" +distro = ">=1.7.0,<2" +httpx = ">=0.23.0,<1" +jiter = ">=0.10.0,<1" +pydantic = ">=1.9.0,<3" +sniffio = "*" +tqdm = ">4" +typing-extensions = ">=4.11,<5" + +[package.extras] +aiohttp = ["aiohttp", "httpx-aiohttp (>=0.1.9)"] +datalib = ["numpy (>=1)", "pandas (>=1.2.3)", "pandas-stubs (>=1.1.0.11)"] +realtime = ["websockets (>=13,<16)"] +voice-helpers = ["numpy (>=2.0.2)", "sounddevice (>=0.5.1)"] + [[package]] name = "orjson" version = "3.11.4" @@ -2074,7 +2264,7 @@ files = [ {file = "orjson-3.11.4-cp39-cp39-win_amd64.whl", hash = "sha256:e2985ce8b8c42d00492d0ed79f2bd2b6460d00f2fa671dfde4bf2e02f49bf5c6"}, {file = "orjson-3.11.4.tar.gz", hash = "sha256:39485f4ab4c9b30a3943cfe99e1a213c4776fb69e8abd68f66b83d5a0b0fdc6d"}, ] -markers = {main = "platform_python_implementation != \"PyPy\"", test = "platform_python_implementation != \"PyPy\""} +markers = {main = "platform_python_implementation != \"PyPy\""} [[package]] name = "ormsgpack" @@ -2082,7 +2272,7 @@ version = "1.11.0" description = "" optional = false python-versions = ">=3.9" -groups = ["test-integration"] +groups = ["test", "test-integration"] markers = "python_version == \"3.9\" or platform_python_implementation == \"PyPy\" and python_version < \"3.13\"" files = [ {file = "ormsgpack-1.11.0-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:03d4e658dd6e1882a552ce1d13cc7b49157414e7d56a4091fbe7823225b08cba"}, @@ -2149,7 +2339,7 @@ version = "1.12.0" description = "" optional = false python-versions = ">=3.10" -groups = ["test-integration"] +groups = ["test", "test-integration"] markers = "platform_python_implementation != \"PyPy\" and python_version >= \"3.10\" or python_version >= \"3.13\"" files = [ {file = "ormsgpack-1.12.0-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:e08904c232358b94a682ccfbb680bc47d3fd5c424bb7dccb65974dd20c95e8e1"}, @@ -2707,6 +2897,25 @@ pytest = ">=4.6" [package.extras] testing = ["fields", "hunter", "process-tests", "pytest-xdist", "six", "virtualenv"] +[[package]] +name = "pytest-httpx" +version = "0.28.0" +description = "Send responses to httpx." +optional = false +python-versions = ">=3.9" +groups = ["test"] +files = [ + {file = "pytest_httpx-0.28.0-py3-none-any.whl", hash = "sha256:045774556a3633688742315a6981aab2806ce93bcbcc8444253ab87bca286800"}, + {file = "pytest_httpx-0.28.0.tar.gz", hash = "sha256:a82505fdf59f19eaaf2853db3f3832b3dee35d3bc58000232db2b65c5fca0614"}, +] + +[package.dependencies] +httpx = "==0.26.*" +pytest = "==7.*" + +[package.extras] +testing = ["pytest-asyncio (==0.23.*)", "pytest-cov (==4.*)"] + [[package]] name = "pytest-mock" version = "3.15.1" @@ -2886,6 +3095,131 @@ files = [ {file = "pyyaml-6.0.3.tar.gz", hash = "sha256:d76623373421df22fb4cf8817020cbb7ef15c725b9d5e45f17e189bfc384190f"}, ] +[[package]] +name = "regex" +version = "2025.11.3" +description = "Alternative regular expression module, to replace re." +optional = false +python-versions = ">=3.9" +groups = ["main", "test"] +files = [ + {file = "regex-2025.11.3-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:2b441a4ae2c8049106e8b39973bfbddfb25a179dda2bdb99b0eeb60c40a6a3af"}, + {file = "regex-2025.11.3-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:2fa2eed3f76677777345d2f81ee89f5de2f5745910e805f7af7386a920fa7313"}, + {file = "regex-2025.11.3-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:d8b4a27eebd684319bdf473d39f1d79eed36bf2cd34bd4465cdb4618d82b3d56"}, + {file = "regex-2025.11.3-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5cf77eac15bd264986c4a2c63353212c095b40f3affb2bc6b4ef80c4776c1a28"}, + {file = "regex-2025.11.3-cp310-cp310-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:b7f9ee819f94c6abfa56ec7b1dbab586f41ebbdc0a57e6524bd5e7f487a878c7"}, + {file = "regex-2025.11.3-cp310-cp310-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:838441333bc90b829406d4a03cb4b8bf7656231b84358628b0406d803931ef32"}, + {file = "regex-2025.11.3-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:cfe6d3f0c9e3b7e8c0c694b24d25e677776f5ca26dce46fd6b0489f9c8339391"}, + {file = "regex-2025.11.3-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:2ab815eb8a96379a27c3b6157fcb127c8f59c36f043c1678110cea492868f1d5"}, + {file = "regex-2025.11.3-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:728a9d2d173a65b62bdc380b7932dd8e74ed4295279a8fe1021204ce210803e7"}, + {file = "regex-2025.11.3-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:509dc827f89c15c66a0c216331260d777dd6c81e9a4e4f830e662b0bb296c313"}, + {file = "regex-2025.11.3-cp310-cp310-musllinux_1_2_s390x.whl", hash = "sha256:849202cd789e5f3cf5dcc7822c34b502181b4824a65ff20ce82da5524e45e8e9"}, + {file = "regex-2025.11.3-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:b6f78f98741dcc89607c16b1e9426ee46ce4bf31ac5e6b0d40e81c89f3481ea5"}, + {file = "regex-2025.11.3-cp310-cp310-win32.whl", hash = "sha256:149eb0bba95231fb4f6d37c8f760ec9fa6fabf65bab555e128dde5f2475193ec"}, + {file = "regex-2025.11.3-cp310-cp310-win_amd64.whl", hash = "sha256:ee3a83ce492074c35a74cc76cf8235d49e77b757193a5365ff86e3f2f93db9fd"}, + {file = "regex-2025.11.3-cp310-cp310-win_arm64.whl", hash = "sha256:38af559ad934a7b35147716655d4a2f79fcef2d695ddfe06a06ba40ae631fa7e"}, + {file = "regex-2025.11.3-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:eadade04221641516fa25139273505a1c19f9bf97589a05bc4cfcd8b4a618031"}, + {file = "regex-2025.11.3-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:feff9e54ec0dd3833d659257f5c3f5322a12eee58ffa360984b716f8b92983f4"}, + {file = "regex-2025.11.3-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:3b30bc921d50365775c09a7ed446359e5c0179e9e2512beec4a60cbcef6ddd50"}, + {file = "regex-2025.11.3-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:f99be08cfead2020c7ca6e396c13543baea32343b7a9a5780c462e323bd8872f"}, + {file = "regex-2025.11.3-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:6dd329a1b61c0ee95ba95385fb0c07ea0d3fe1a21e1349fa2bec272636217118"}, + {file = "regex-2025.11.3-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:4c5238d32f3c5269d9e87be0cf096437b7622b6920f5eac4fd202468aaeb34d2"}, + {file = "regex-2025.11.3-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:10483eefbfb0adb18ee9474498c9a32fcf4e594fbca0543bb94c48bac6183e2e"}, + {file = "regex-2025.11.3-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:78c2d02bb6e1da0720eedc0bad578049cad3f71050ef8cd065ecc87691bed2b0"}, + {file = "regex-2025.11.3-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:e6b49cd2aad93a1790ce9cffb18964f6d3a4b0b3dbdbd5de094b65296fce6e58"}, + {file = "regex-2025.11.3-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:885b26aa3ee56433b630502dc3d36ba78d186a00cc535d3806e6bfd9ed3c70ab"}, + {file = "regex-2025.11.3-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:ddd76a9f58e6a00f8772e72cff8ebcff78e022be95edf018766707c730593e1e"}, + {file = "regex-2025.11.3-cp311-cp311-win32.whl", hash = "sha256:3e816cc9aac1cd3cc9a4ec4d860f06d40f994b5c7b4d03b93345f44e08cc68bf"}, + {file = "regex-2025.11.3-cp311-cp311-win_amd64.whl", hash = "sha256:087511f5c8b7dfbe3a03f5d5ad0c2a33861b1fc387f21f6f60825a44865a385a"}, + {file = "regex-2025.11.3-cp311-cp311-win_arm64.whl", hash = "sha256:1ff0d190c7f68ae7769cd0313fe45820ba07ffebfddfaa89cc1eb70827ba0ddc"}, + {file = "regex-2025.11.3-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:bc8ab71e2e31b16e40868a40a69007bc305e1109bd4658eb6cad007e0bf67c41"}, + {file = "regex-2025.11.3-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:22b29dda7e1f7062a52359fca6e58e548e28c6686f205e780b02ad8ef710de36"}, + {file = "regex-2025.11.3-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:3a91e4a29938bc1a082cc28fdea44be420bf2bebe2665343029723892eb073e1"}, + {file = "regex-2025.11.3-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:08b884f4226602ad40c5d55f52bf91a9df30f513864e0054bad40c0e9cf1afb7"}, + {file = "regex-2025.11.3-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:3e0b11b2b2433d1c39c7c7a30e3f3d0aeeea44c2a8d0bae28f6b95f639927a69"}, + {file = "regex-2025.11.3-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:87eb52a81ef58c7ba4d45c3ca74e12aa4b4e77816f72ca25258a85b3ea96cb48"}, + {file = "regex-2025.11.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a12ab1f5c29b4e93db518f5e3872116b7e9b1646c9f9f426f777b50d44a09e8c"}, + {file = "regex-2025.11.3-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:7521684c8c7c4f6e88e35ec89680ee1aa8358d3f09d27dfbdf62c446f5d4c695"}, + {file = "regex-2025.11.3-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:7fe6e5440584e94cc4b3f5f4d98a25e29ca12dccf8873679a635638349831b98"}, + {file = "regex-2025.11.3-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:8e026094aa12b43f4fd74576714e987803a315c76edb6b098b9809db5de58f74"}, + {file = "regex-2025.11.3-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:435bbad13e57eb5606a68443af62bed3556de2f46deb9f7d4237bc2f1c9fb3a0"}, + {file = "regex-2025.11.3-cp312-cp312-win32.whl", hash = "sha256:3839967cf4dc4b985e1570fd8d91078f0c519f30491c60f9ac42a8db039be204"}, + {file = "regex-2025.11.3-cp312-cp312-win_amd64.whl", hash = "sha256:e721d1b46e25c481dc5ded6f4b3f66c897c58d2e8cfdf77bbced84339108b0b9"}, + {file = "regex-2025.11.3-cp312-cp312-win_arm64.whl", hash = "sha256:64350685ff08b1d3a6fff33f45a9ca183dc1d58bbfe4981604e70ec9801bbc26"}, + {file = "regex-2025.11.3-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:c1e448051717a334891f2b9a620fe36776ebf3dd8ec46a0b877c8ae69575feb4"}, + {file = "regex-2025.11.3-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:9b5aca4d5dfd7fbfbfbdaf44850fcc7709a01146a797536a8f84952e940cca76"}, + {file = "regex-2025.11.3-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:04d2765516395cf7dda331a244a3282c0f5ae96075f728629287dfa6f76ba70a"}, + {file = "regex-2025.11.3-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5d9903ca42bfeec4cebedba8022a7c97ad2aab22e09573ce9976ba01b65e4361"}, + {file = "regex-2025.11.3-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:639431bdc89d6429f6721625e8129413980ccd62e9d3f496be618a41d205f160"}, + {file = "regex-2025.11.3-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:f117efad42068f9715677c8523ed2be1518116d1c49b1dd17987716695181efe"}, + {file = "regex-2025.11.3-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:4aecb6f461316adf9f1f0f6a4a1a3d79e045f9b71ec76055a791affa3b285850"}, + {file = "regex-2025.11.3-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:3b3a5f320136873cc5561098dfab677eea139521cb9a9e8db98b7e64aef44cbc"}, + {file = "regex-2025.11.3-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:75fa6f0056e7efb1f42a1c34e58be24072cb9e61a601340cc1196ae92326a4f9"}, + {file = "regex-2025.11.3-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:dbe6095001465294f13f1adcd3311e50dd84e5a71525f20a10bd16689c61ce0b"}, + {file = "regex-2025.11.3-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:454d9b4ae7881afbc25015b8627c16d88a597479b9dea82b8c6e7e2e07240dc7"}, + {file = "regex-2025.11.3-cp313-cp313-win32.whl", hash = "sha256:28ba4d69171fc6e9896337d4fc63a43660002b7da53fc15ac992abcf3410917c"}, + {file = "regex-2025.11.3-cp313-cp313-win_amd64.whl", hash = "sha256:bac4200befe50c670c405dc33af26dad5a3b6b255dd6c000d92fe4629f9ed6a5"}, + {file = "regex-2025.11.3-cp313-cp313-win_arm64.whl", hash = "sha256:2292cd5a90dab247f9abe892ac584cb24f0f54680c73fcb4a7493c66c2bf2467"}, + {file = "regex-2025.11.3-cp313-cp313t-macosx_10_13_universal2.whl", hash = "sha256:1eb1ebf6822b756c723e09f5186473d93236c06c579d2cc0671a722d2ab14281"}, + {file = "regex-2025.11.3-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:1e00ec2970aab10dc5db34af535f21fcf32b4a31d99e34963419636e2f85ae39"}, + {file = "regex-2025.11.3-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:a4cb042b615245d5ff9b3794f56be4138b5adc35a4166014d31d1814744148c7"}, + {file = "regex-2025.11.3-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:44f264d4bf02f3176467d90b294d59bf1db9fe53c141ff772f27a8b456b2a9ed"}, + {file = "regex-2025.11.3-cp313-cp313t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:7be0277469bf3bd7a34a9c57c1b6a724532a0d235cd0dc4e7f4316f982c28b19"}, + {file = "regex-2025.11.3-cp313-cp313t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:0d31e08426ff4b5b650f68839f5af51a92a5b51abd8554a60c2fbc7c71f25d0b"}, + {file = "regex-2025.11.3-cp313-cp313t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:e43586ce5bd28f9f285a6e729466841368c4a0353f6fd08d4ce4630843d3648a"}, + {file = "regex-2025.11.3-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:0f9397d561a4c16829d4e6ff75202c1c08b68a3bdbfe29dbfcdb31c9830907c6"}, + {file = "regex-2025.11.3-cp313-cp313t-musllinux_1_2_ppc64le.whl", hash = "sha256:dd16e78eb18ffdb25ee33a0682d17912e8cc8a770e885aeee95020046128f1ce"}, + {file = "regex-2025.11.3-cp313-cp313t-musllinux_1_2_s390x.whl", hash = "sha256:ffcca5b9efe948ba0661e9df0fa50d2bc4b097c70b9810212d6b62f05d83b2dd"}, + {file = "regex-2025.11.3-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:c56b4d162ca2b43318ac671c65bd4d563e841a694ac70e1a976ac38fcf4ca1d2"}, + {file = "regex-2025.11.3-cp313-cp313t-win32.whl", hash = "sha256:9ddc42e68114e161e51e272f667d640f97e84a2b9ef14b7477c53aac20c2d59a"}, + {file = "regex-2025.11.3-cp313-cp313t-win_amd64.whl", hash = "sha256:7a7c7fdf755032ffdd72c77e3d8096bdcb0eb92e89e17571a196f03d88b11b3c"}, + {file = "regex-2025.11.3-cp313-cp313t-win_arm64.whl", hash = "sha256:df9eb838c44f570283712e7cff14c16329a9f0fb19ca492d21d4b7528ee6821e"}, + {file = "regex-2025.11.3-cp314-cp314-macosx_10_13_universal2.whl", hash = "sha256:9697a52e57576c83139d7c6f213d64485d3df5bf84807c35fa409e6c970801c6"}, + {file = "regex-2025.11.3-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:e18bc3f73bd41243c9b38a6d9f2366cd0e0137a9aebe2d8ff76c5b67d4c0a3f4"}, + {file = "regex-2025.11.3-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:61a08bcb0ec14ff4e0ed2044aad948d0659604f824cbd50b55e30b0ec6f09c73"}, + {file = "regex-2025.11.3-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c9c30003b9347c24bcc210958c5d167b9e4f9be786cb380a7d32f14f9b84674f"}, + {file = "regex-2025.11.3-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:4e1e592789704459900728d88d41a46fe3969b82ab62945560a31732ffc19a6d"}, + {file = "regex-2025.11.3-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:6538241f45eb5a25aa575dbba1069ad786f68a4f2773a29a2bd3dd1f9de787be"}, + {file = "regex-2025.11.3-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:bce22519c989bb72a7e6b36a199384c53db7722fe669ba891da75907fe3587db"}, + {file = "regex-2025.11.3-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:66d559b21d3640203ab9075797a55165d79017520685fb407b9234d72ab63c62"}, + {file = "regex-2025.11.3-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:669dcfb2e38f9e8c69507bace46f4889e3abbfd9b0c29719202883c0a603598f"}, + {file = "regex-2025.11.3-cp314-cp314-musllinux_1_2_s390x.whl", hash = "sha256:32f74f35ff0f25a5021373ac61442edcb150731fbaa28286bbc8bb1582c89d02"}, + {file = "regex-2025.11.3-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:e6c7a21dffba883234baefe91bc3388e629779582038f75d2a5be918e250f0ed"}, + {file = "regex-2025.11.3-cp314-cp314-win32.whl", hash = "sha256:795ea137b1d809eb6836b43748b12634291c0ed55ad50a7d72d21edf1cd565c4"}, + {file = "regex-2025.11.3-cp314-cp314-win_amd64.whl", hash = "sha256:9f95fbaa0ee1610ec0fc6b26668e9917a582ba80c52cc6d9ada15e30aa9ab9ad"}, + {file = "regex-2025.11.3-cp314-cp314-win_arm64.whl", hash = "sha256:dfec44d532be4c07088c3de2876130ff0fbeeacaa89a137decbbb5f665855a0f"}, + {file = "regex-2025.11.3-cp314-cp314t-macosx_10_13_universal2.whl", hash = "sha256:ba0d8a5d7f04f73ee7d01d974d47c5834f8a1b0224390e4fe7c12a3a92a78ecc"}, + {file = "regex-2025.11.3-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:442d86cf1cfe4faabf97db7d901ef58347efd004934da045c745e7b5bd57ac49"}, + {file = "regex-2025.11.3-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:fd0a5e563c756de210bb964789b5abe4f114dacae9104a47e1a649b910361536"}, + {file = "regex-2025.11.3-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:bf3490bcbb985a1ae97b2ce9ad1c0f06a852d5b19dde9b07bdf25bf224248c95"}, + {file = "regex-2025.11.3-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:3809988f0a8b8c9dcc0f92478d6501fac7200b9ec56aecf0ec21f4a2ec4b6009"}, + {file = "regex-2025.11.3-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:f4ff94e58e84aedb9c9fce66d4ef9f27a190285b451420f297c9a09f2b9abee9"}, + {file = "regex-2025.11.3-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:7eb542fd347ce61e1321b0a6b945d5701528dca0cd9759c2e3bb8bd57e47964d"}, + {file = "regex-2025.11.3-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:d6c2d5919075a1f2e413c00b056ea0c2f065b3f5fe83c3d07d325ab92dce51d6"}, + {file = "regex-2025.11.3-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:3f8bf11a4827cc7ce5a53d4ef6cddd5ad25595d3c1435ef08f76825851343154"}, + {file = "regex-2025.11.3-cp314-cp314t-musllinux_1_2_s390x.whl", hash = "sha256:22c12d837298651e5550ac1d964e4ff57c3f56965fc1812c90c9fb2028eaf267"}, + {file = "regex-2025.11.3-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:62ba394a3dda9ad41c7c780f60f6e4a70988741415ae96f6d1bf6c239cf01379"}, + {file = "regex-2025.11.3-cp314-cp314t-win32.whl", hash = "sha256:4bf146dca15cdd53224a1bf46d628bd7590e4a07fbb69e720d561aea43a32b38"}, + {file = "regex-2025.11.3-cp314-cp314t-win_amd64.whl", hash = "sha256:adad1a1bcf1c9e76346e091d22d23ac54ef28e1365117d99521631078dfec9de"}, + {file = "regex-2025.11.3-cp314-cp314t-win_arm64.whl", hash = "sha256:c54f768482cef41e219720013cd05933b6f971d9562544d691c68699bf2b6801"}, + {file = "regex-2025.11.3-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:81519e25707fc076978c6143b81ea3dc853f176895af05bf7ec51effe818aeec"}, + {file = "regex-2025.11.3-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:3bf28b1873a8af8bbb58c26cc56ea6e534d80053b41fb511a35795b6de507e6a"}, + {file = "regex-2025.11.3-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:856a25c73b697f2ce2a24e7968285579e62577a048526161a2c0f53090bea9f9"}, + {file = "regex-2025.11.3-cp39-cp39-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:8a3d571bd95fade53c86c0517f859477ff3a93c3fde10c9e669086f038e0f207"}, + {file = "regex-2025.11.3-cp39-cp39-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:732aea6de26051af97b94bc98ed86448821f839d058e5d259c72bf6d73ad0fc0"}, + {file = "regex-2025.11.3-cp39-cp39-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:51c1c1847128238f54930edb8805b660305dca164645a9fd29243f5610beea34"}, + {file = "regex-2025.11.3-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:22dd622a402aad4558277305350699b2be14bc59f64d64ae1d928ce7d072dced"}, + {file = "regex-2025.11.3-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:f3b5a391c7597ffa96b41bd5cbd2ed0305f515fcbb367dfa72735679d5502364"}, + {file = "regex-2025.11.3-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:cc4076a5b4f36d849fd709284b4a3b112326652f3b0466f04002a6c15a0c96c1"}, + {file = "regex-2025.11.3-cp39-cp39-musllinux_1_2_ppc64le.whl", hash = "sha256:a295ca2bba5c1c885826ce3125fa0b9f702a1be547d821c01d65f199e10c01e2"}, + {file = "regex-2025.11.3-cp39-cp39-musllinux_1_2_s390x.whl", hash = "sha256:b4774ff32f18e0504bfc4e59a3e71e18d83bc1e171a3c8ed75013958a03b2f14"}, + {file = "regex-2025.11.3-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:22e7d1cdfa88ef33a2ae6aa0d707f9255eb286ffbd90045f1088246833223aee"}, + {file = "regex-2025.11.3-cp39-cp39-win32.whl", hash = "sha256:74d04244852ff73b32eeede4f76f51c5bcf44bc3c207bc3e6cf1c5c45b890708"}, + {file = "regex-2025.11.3-cp39-cp39-win_amd64.whl", hash = "sha256:7a50cd39f73faa34ec18d6720ee25ef10c4c1839514186fcda658a06c06057a2"}, + {file = "regex-2025.11.3-cp39-cp39-win_arm64.whl", hash = "sha256:43b4fb020e779ca81c1b5255015fe2b82816c76ec982354534ad9ec09ad7c9e3"}, + {file = "regex-2025.11.3.tar.gz", hash = "sha256:1fedc720f9bb2494ce31a58a1631f9c82df6a09b49c19517ea5cc280b4541e01"}, +] + [[package]] name = "requests" version = "2.32.5" @@ -3142,6 +3476,80 @@ files = [ doc = ["reno", "sphinx"] test = ["pytest", "tornado (>=4.5)", "typeguard"] +[[package]] +name = "tiktoken" +version = "0.12.0" +description = "tiktoken is a fast BPE tokeniser for use with OpenAI's models" +optional = false +python-versions = ">=3.9" +groups = ["main", "test"] +files = [ + {file = "tiktoken-0.12.0-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:3de02f5a491cfd179aec916eddb70331814bd6bf764075d39e21d5862e533970"}, + {file = "tiktoken-0.12.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:b6cfb6d9b7b54d20af21a912bfe63a2727d9cfa8fbda642fd8322c70340aad16"}, + {file = "tiktoken-0.12.0-cp310-cp310-manylinux_2_28_aarch64.whl", hash = "sha256:cde24cdb1b8a08368f709124f15b36ab5524aac5fa830cc3fdce9c03d4fb8030"}, + {file = "tiktoken-0.12.0-cp310-cp310-manylinux_2_28_x86_64.whl", hash = "sha256:6de0da39f605992649b9cfa6f84071e3f9ef2cec458d08c5feb1b6f0ff62e134"}, + {file = "tiktoken-0.12.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:6faa0534e0eefbcafaccb75927a4a380463a2eaa7e26000f0173b920e98b720a"}, + {file = "tiktoken-0.12.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:82991e04fc860afb933efb63957affc7ad54f83e2216fe7d319007dab1ba5892"}, + {file = "tiktoken-0.12.0-cp310-cp310-win_amd64.whl", hash = "sha256:6fb2995b487c2e31acf0a9e17647e3b242235a20832642bb7a9d1a181c0c1bb1"}, + {file = "tiktoken-0.12.0-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:6e227c7f96925003487c33b1b32265fad2fbcec2b7cf4817afb76d416f40f6bb"}, + {file = "tiktoken-0.12.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:c06cf0fcc24c2cb2adb5e185c7082a82cba29c17575e828518c2f11a01f445aa"}, + {file = "tiktoken-0.12.0-cp311-cp311-manylinux_2_28_aarch64.whl", hash = "sha256:f18f249b041851954217e9fd8e5c00b024ab2315ffda5ed77665a05fa91f42dc"}, + {file = "tiktoken-0.12.0-cp311-cp311-manylinux_2_28_x86_64.whl", hash = "sha256:47a5bc270b8c3db00bb46ece01ef34ad050e364b51d406b6f9730b64ac28eded"}, + {file = "tiktoken-0.12.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:508fa71810c0efdcd1b898fda574889ee62852989f7c1667414736bcb2b9a4bd"}, + {file = "tiktoken-0.12.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:a1af81a6c44f008cba48494089dd98cccb8b313f55e961a52f5b222d1e507967"}, + {file = "tiktoken-0.12.0-cp311-cp311-win_amd64.whl", hash = "sha256:3e68e3e593637b53e56f7237be560f7a394451cb8c11079755e80ae64b9e6def"}, + {file = "tiktoken-0.12.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:b97f74aca0d78a1ff21b8cd9e9925714c15a9236d6ceacf5c7327c117e6e21e8"}, + {file = "tiktoken-0.12.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:2b90f5ad190a4bb7c3eb30c5fa32e1e182ca1ca79f05e49b448438c3e225a49b"}, + {file = "tiktoken-0.12.0-cp312-cp312-manylinux_2_28_aarch64.whl", hash = "sha256:65b26c7a780e2139e73acc193e5c63ac754021f160df919add909c1492c0fb37"}, + {file = "tiktoken-0.12.0-cp312-cp312-manylinux_2_28_x86_64.whl", hash = "sha256:edde1ec917dfd21c1f2f8046b86348b0f54a2c0547f68149d8600859598769ad"}, + {file = "tiktoken-0.12.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:35a2f8ddd3824608b3d650a000c1ef71f730d0c56486845705a8248da00f9fe5"}, + {file = "tiktoken-0.12.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:83d16643edb7fa2c99eff2ab7733508aae1eebb03d5dfc46f5565862810f24e3"}, + {file = "tiktoken-0.12.0-cp312-cp312-win_amd64.whl", hash = "sha256:ffc5288f34a8bc02e1ea7047b8d041104791d2ddbf42d1e5fa07822cbffe16bd"}, + {file = "tiktoken-0.12.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:775c2c55de2310cc1bc9a3ad8826761cbdc87770e586fd7b6da7d4589e13dab3"}, + {file = "tiktoken-0.12.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:a01b12f69052fbe4b080a2cfb867c4de12c704b56178edf1d1d7b273561db160"}, + {file = "tiktoken-0.12.0-cp313-cp313-manylinux_2_28_aarch64.whl", hash = "sha256:01d99484dc93b129cd0964f9d34eee953f2737301f18b3c7257bf368d7615baa"}, + {file = "tiktoken-0.12.0-cp313-cp313-manylinux_2_28_x86_64.whl", hash = "sha256:4a1a4fcd021f022bfc81904a911d3df0f6543b9e7627b51411da75ff2fe7a1be"}, + {file = "tiktoken-0.12.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:981a81e39812d57031efdc9ec59fa32b2a5a5524d20d4776574c4b4bd2e9014a"}, + {file = "tiktoken-0.12.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:9baf52f84a3f42eef3ff4e754a0db79a13a27921b457ca9832cf944c6be4f8f3"}, + {file = "tiktoken-0.12.0-cp313-cp313-win_amd64.whl", hash = "sha256:b8a0cd0c789a61f31bf44851defbd609e8dd1e2c8589c614cc1060940ef1f697"}, + {file = "tiktoken-0.12.0-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:d5f89ea5680066b68bcb797ae85219c72916c922ef0fcdd3480c7d2315ffff16"}, + {file = "tiktoken-0.12.0-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:b4e7ed1c6a7a8a60a3230965bdedba8cc58f68926b835e519341413370e0399a"}, + {file = "tiktoken-0.12.0-cp313-cp313t-manylinux_2_28_aarch64.whl", hash = "sha256:fc530a28591a2d74bce821d10b418b26a094bf33839e69042a6e86ddb7a7fb27"}, + {file = "tiktoken-0.12.0-cp313-cp313t-manylinux_2_28_x86_64.whl", hash = "sha256:06a9f4f49884139013b138920a4c393aa6556b2f8f536345f11819389c703ebb"}, + {file = "tiktoken-0.12.0-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:04f0e6a985d95913cabc96a741c5ffec525a2c72e9df086ff17ebe35985c800e"}, + {file = "tiktoken-0.12.0-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:0ee8f9ae00c41770b5f9b0bb1235474768884ae157de3beb5439ca0fd70f3e25"}, + {file = "tiktoken-0.12.0-cp313-cp313t-win_amd64.whl", hash = "sha256:dc2dd125a62cb2b3d858484d6c614d136b5b848976794edfb63688d539b8b93f"}, + {file = "tiktoken-0.12.0-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:a90388128df3b3abeb2bfd1895b0681412a8d7dc644142519e6f0a97c2111646"}, + {file = "tiktoken-0.12.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:da900aa0ad52247d8794e307d6446bd3cdea8e192769b56276695d34d2c9aa88"}, + {file = "tiktoken-0.12.0-cp314-cp314-manylinux_2_28_aarch64.whl", hash = "sha256:285ba9d73ea0d6171e7f9407039a290ca77efcdb026be7769dccc01d2c8d7fff"}, + {file = "tiktoken-0.12.0-cp314-cp314-manylinux_2_28_x86_64.whl", hash = "sha256:d186a5c60c6a0213f04a7a802264083dea1bbde92a2d4c7069e1a56630aef830"}, + {file = "tiktoken-0.12.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:604831189bd05480f2b885ecd2d1986dc7686f609de48208ebbbddeea071fc0b"}, + {file = "tiktoken-0.12.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:8f317e8530bb3a222547b85a58583238c8f74fd7a7408305f9f63246d1a0958b"}, + {file = "tiktoken-0.12.0-cp314-cp314-win_amd64.whl", hash = "sha256:399c3dd672a6406719d84442299a490420b458c44d3ae65516302a99675888f3"}, + {file = "tiktoken-0.12.0-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:c2c714c72bc00a38ca969dae79e8266ddec999c7ceccd603cc4f0d04ccd76365"}, + {file = "tiktoken-0.12.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:cbb9a3ba275165a2cb0f9a83f5d7025afe6b9d0ab01a22b50f0e74fee2ad253e"}, + {file = "tiktoken-0.12.0-cp314-cp314t-manylinux_2_28_aarch64.whl", hash = "sha256:dfdfaa5ffff8993a3af94d1125870b1d27aed7cb97aa7eb8c1cefdbc87dbee63"}, + {file = "tiktoken-0.12.0-cp314-cp314t-manylinux_2_28_x86_64.whl", hash = "sha256:584c3ad3d0c74f5269906eb8a659c8bfc6144a52895d9261cdaf90a0ae5f4de0"}, + {file = "tiktoken-0.12.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:54c891b416a0e36b8e2045b12b33dd66fb34a4fe7965565f1b482da50da3e86a"}, + {file = "tiktoken-0.12.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:5edb8743b88d5be814b1a8a8854494719080c28faaa1ccbef02e87354fe71ef0"}, + {file = "tiktoken-0.12.0-cp314-cp314t-win_amd64.whl", hash = "sha256:f61c0aea5565ac82e2ec50a05e02a6c44734e91b51c10510b084ea1b8e633a71"}, + {file = "tiktoken-0.12.0-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:d51d75a5bffbf26f86554d28e78bfb921eae998edc2675650fd04c7e1f0cdc1e"}, + {file = "tiktoken-0.12.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:09eb4eae62ae7e4c62364d9ec3a57c62eea707ac9a2b2c5d6bd05de6724ea179"}, + {file = "tiktoken-0.12.0-cp39-cp39-manylinux_2_28_aarch64.whl", hash = "sha256:df37684ace87d10895acb44b7f447d4700349b12197a526da0d4a4149fde074c"}, + {file = "tiktoken-0.12.0-cp39-cp39-manylinux_2_28_x86_64.whl", hash = "sha256:4c9614597ac94bb294544345ad8cf30dac2129c05e2db8dc53e082f355857af7"}, + {file = "tiktoken-0.12.0-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:20cf97135c9a50de0b157879c3c4accbb29116bcf001283d26e073ff3b345946"}, + {file = "tiktoken-0.12.0-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:15d875454bbaa3728be39880ddd11a5a2a9e548c29418b41e8fd8a767172b5ec"}, + {file = "tiktoken-0.12.0-cp39-cp39-win_amd64.whl", hash = "sha256:2cff3688ba3c639ebe816f8d58ffbbb0aa7433e23e08ab1cade5d175fc973fb3"}, + {file = "tiktoken-0.12.0.tar.gz", hash = "sha256:b18ba7ee2b093863978fcb14f74b3707cdc8d4d4d3836853ce7ec60772139931"}, +] + +[package.dependencies] +regex = ">=2022.1.18" +requests = ">=2.26.0" + +[package.extras] +blobfile = ["blobfile (>=2)"] + [[package]] name = "tomli" version = "2.3.0" @@ -3195,6 +3603,28 @@ files = [ ] markers = {test = "python_full_version <= \"3.11.0a6\"", typing = "python_version < \"3.11\""} +[[package]] +name = "tqdm" +version = "4.67.1" +description = "Fast, Extensible Progress Meter" +optional = false +python-versions = ">=3.7" +groups = ["main", "test"] +files = [ + {file = "tqdm-4.67.1-py3-none-any.whl", hash = "sha256:26445eca388f82e72884e0d580d5464cd801a3ea01e63e5601bdff9ba6a48de2"}, + {file = "tqdm-4.67.1.tar.gz", hash = "sha256:f8aef9c52c08c13a65f30ea34f4e5aac3fd1a34959879d7e59e63027286627f2"}, +] + +[package.dependencies] +colorama = {version = "*", markers = "platform_system == \"Windows\""} + +[package.extras] +dev = ["nbval", "pytest (>=6)", "pytest-asyncio (>=0.24)", "pytest-cov", "pytest-timeout"] +discord = ["requests"] +notebook = ["ipywidgets (>=6)"] +slack = ["slack-sdk"] +telegram = ["requests"] + [[package]] name = "types-requests" version = "2.31.0.6" @@ -3772,4 +4202,4 @@ cffi = ["cffi (>=1.17,<2.0) ; platform_python_implementation != \"PyPy\" and pyt [metadata] lock-version = "2.1" python-versions = ">=3.9,<4.0" -content-hash = "230a6c292166c267991f49901202f2823da065c49abc8c66350a179622855d0b" +content-hash = "6e2633b00fb7c24485cbc468a8def23db320695fed3fa97a158e3875b3b7771b" diff --git a/libs/oci/pyproject.toml b/libs/oci/pyproject.toml index b997b4f..140959d 100644 --- a/libs/oci/pyproject.toml +++ b/libs/oci/pyproject.toml @@ -17,6 +17,9 @@ langchain = ">=0.3.20,<1.0.0" oci = ">=2.161.0" pydantic = ">=2,<3" aiohttp = ">=3.12.14" +openai = "^2.6.1" +oci-openai = "^1.0.0" +langchain-openai = "^0.3.35" [tool.poetry.group.test] optional = true @@ -30,7 +33,10 @@ pytest-watcher = "^0.3.4" langchain-tests = "^0.3.12" pytest-socket = "^0.7.0" pytest-mock = "^3.15.0" +pytest-httpx = "^0.28.0" responses = "^0.25.8" +langgraph = "^0.2.0" +langchain-openai = "^0.3.35" [tool.poetry.group.codespell] @@ -95,6 +101,7 @@ module = [ "oci.*", "ads.*", "langchain_openai.*", + "oci_openai.*", ] ignore_missing_imports = true diff --git a/libs/oci/tests/integration_tests/chat_models/test_response_format.py b/libs/oci/tests/integration_tests/chat_models/test_response_format.py index ca32fcc..fc1d1d9 100644 --- a/libs/oci/tests/integration_tests/chat_models/test_response_format.py +++ b/libs/oci/tests/integration_tests/chat_models/test_response_format.py @@ -283,7 +283,7 @@ def test_response_format_via_model_kwargs(): # Verify valid JSON try: - parsed = json.loads(response.content) + parsed = json.loads(response.content) # type: ignore assert isinstance(parsed, dict), "Response should be a JSON object" except json.JSONDecodeError as e: pytest.fail( diff --git a/libs/oci/tests/integration_tests/chat_models/test_tool_calling.py b/libs/oci/tests/integration_tests/chat_models/test_tool_calling.py index 0936afe..9c07763 100644 --- a/libs/oci/tests/integration_tests/chat_models/test_tool_calling.py +++ b/libs/oci/tests/integration_tests/chat_models/test_tool_calling.py @@ -479,9 +479,10 @@ def should_continue(state: MessagesState): # the max_sequential_tool_calls limit, which is expected behavior. # The key is that it STOPPED (didn't continue infinitely). final_message = messages[-1] - assert type(final_message).__name__ in ["AIMessage", "ToolMessage"], ( - "Final message should be AIMessage or ToolMessage" - ) + assert type(final_message).__name__ in [ + "AIMessage", + "ToolMessage", + ], "Final message should be AIMessage or ToolMessage" # Verify the agent didn't hit infinite loop by checking message count # With max_sequential_tool_calls=8, we expect roughly: diff --git a/libs/oci/tests/unit_tests/chat_models/test_oci_data_science.py b/libs/oci/tests/unit_tests/chat_models/test_oci_data_science.py index f3bf9d1..68b7e7a 100644 --- a/libs/oci/tests/unit_tests/chat_models/test_oci_data_science.py +++ b/libs/oci/tests/unit_tests/chat_models/test_oci_data_science.py @@ -112,8 +112,7 @@ def mocked_requests_post(url: str, **kwargs: Any) -> MockResponse: ) -@pytest.mark.requires("ads") -@pytest.mark.requires("langchain_openai") +@pytest.mark.requires("ads", "langchain_openai") @mock.patch("ads.common.auth.default_signer", return_value=dict(signer=None)) @mock.patch("requests.post", side_effect=mocked_requests_post) def test_invoke_vllm(*args: Any) -> None: @@ -125,8 +124,7 @@ def test_invoke_vllm(*args: Any) -> None: assert output.content == CONST_COMPLETION -@pytest.mark.requires("ads") -@pytest.mark.requires("langchain_openai") +@pytest.mark.requires("ads", "langchain_openai") @mock.patch("ads.common.auth.default_signer", return_value=dict(signer=None)) @mock.patch("requests.post", side_effect=mocked_requests_post) def test_invoke_tgi(*args: Any) -> None: @@ -138,8 +136,7 @@ def test_invoke_tgi(*args: Any) -> None: assert output.content == CONST_COMPLETION -@pytest.mark.requires("ads") -@pytest.mark.requires("langchain_openai") +@pytest.mark.requires("ads", "langchain_openai") @mock.patch("ads.common.auth.default_signer", return_value=dict(signer=None)) @mock.patch("requests.post", side_effect=mocked_requests_post) def test_stream_vllm(*args: Any) -> None: @@ -172,8 +169,7 @@ async def mocked_async_streaming_response( @pytest.mark.asyncio -@pytest.mark.requires("ads") -@pytest.mark.requires("langchain_openai") +@pytest.mark.requires("ads", "langchain_openai") @mock.patch( "ads.common.auth.default_signer", return_value=dict(signer=mock.MagicMock()) ) diff --git a/libs/oci/tests/unit_tests/chat_models/test_oci_generative_ai_responses_api.py b/libs/oci/tests/unit_tests/chat_models/test_oci_generative_ai_responses_api.py new file mode 100644 index 0000000..62d63ce --- /dev/null +++ b/libs/oci/tests/unit_tests/chat_models/test_oci_generative_ai_responses_api.py @@ -0,0 +1,430 @@ +import json +from typing import List, TypedDict +from unittest.mock import MagicMock, patch + +import pytest +from httpx import Request +from langchain_core.messages import BaseMessage, HumanMessage +from langchain_core.prompts import ChatPromptTemplate +from langgraph.graph import END, START, StateGraph +from oci_openai import ( + OciInstancePrincipalAuth, + OciResourcePrincipalAuth, + OciSessionAuth, +) +from oci_openai.oci_openai import _resolve_base_url +from pydantic import BaseModel, Field + +from langchain_oci import ChatOCIOpenAI +from langchain_oci.chat_models.oci_generative_ai import ( + COMPARTMENT_ID_HEADER, + CONVERSATION_STORE_ID_HEADER, + _build_headers, +) + +COMPARTMENT_ID = "ocid1.compartment.oc1..dummy" +CONVERSATION_STORE_ID = "ocid1.generativeaiconversationstore.oc1..dummy" +REGION = "us-chicago-1" +MODEL = "openai.gpt-4o" +SESSION_PRINCIPAL = "session_principal" +RESOURCE_PRINCIPAL = "resource_principal" +INSTANCE_PRINCIPAL = "instance_principal" +BASE_URL = _resolve_base_url(region="us-chicago-1") +RESPONSES_URL = f"{BASE_URL}/responses" +RESPONSE_ID = "resp_123" + + +# Fixtures +@pytest.fixture( + params=[ + (SESSION_PRINCIPAL, OciSessionAuth, {"profile_name": "DEFAULT"}), + (RESOURCE_PRINCIPAL, OciResourcePrincipalAuth, {}), + (INSTANCE_PRINCIPAL, OciInstancePrincipalAuth, {}), + ], + ids=[SESSION_PRINCIPAL, RESOURCE_PRINCIPAL, INSTANCE_PRINCIPAL], +) +def auth_instance(request): + name, auth_class, kwargs = request.param + + def set_signer(signer_name: str): + dummy_signer = MagicMock() + patcher = patch(signer_name, return_value=dummy_signer) + patcher.start() + request.addfinalizer(patcher.stop) + kwargs["signer"] = dummy_signer + + if name == RESOURCE_PRINCIPAL: + set_signer(signer_name="oci.auth.signers.get_resource_principals_signer") + elif name == INSTANCE_PRINCIPAL: + set_signer(signer_name="oci.auth.signers.InstancePrincipalsSecurityTokenSigner") + elif name == "session_principal": + # --- Patch config + signer + token/private_key loading --- + patch_config = patch( + "oci.config.from_file", + return_value={ + "user": "ocid1.user.oc1..dummy", + "fingerprint": "dummyfp", + "key_file": "/fake/key.pem", + "tenancy": "ocid1.tenancy.oc1..dummy", + "region": "us-chicago-1", + "security_token_file": "/fake/token", + }, + ) + patch_token = patch.object( + OciSessionAuth, "_load_token", return_value="fake_token_string" + ) + patch_private_key = patch.object( + OciSessionAuth, "_load_private_key", return_value="fake_private_key_data" + ) + patch_signer = patch( + "oci.auth.signers.SecurityTokenSigner", return_value=MagicMock() + ) + # Start all patches + for p in [patch_config, patch_token, patch_private_key, patch_signer]: + p.start() + request.addfinalizer(p.stop) + + return auth_class(**kwargs) + + +def _assert_common(httpx_mock): + last_request: Request = httpx_mock.get_requests()[0] + assert "Authorization" in last_request.headers + assert last_request.headers.get(COMPARTMENT_ID_HEADER) == COMPARTMENT_ID + assert ( + last_request.headers.get(CONVERSATION_STORE_ID_HEADER) == CONVERSATION_STORE_ID + ) + + +function_tools = [ + { + "type": "function", + "name": "get_current_weather", + "description": "Get the current weather in a given location", + "parameters": { + "type": "object", + "properties": { + "location": { + "type": "string", + "description": "The city and state, e.g. San Francisco, CA", + }, + "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]}, + }, + "required": ["location", "unit"], + }, + } +] + + +def _set_mock_client_invoke_response(httpx_mock): + httpx_mock.add_response( + url=RESPONSES_URL, + method="POST", + json={ + "id": RESPONSE_ID, + "output": [ + { + "type": "message", + "status": "completed", + "content": [ + {"type": "output_text", "text": "j'adore la programmation"} + ], + } + ], + }, + status_code=200, + ) + + +class GetWeather(BaseModel): + """Get the current weather in a given location""" + + location: str = Field(..., description="The city and state, e.g. San Francisco, CA") + + +def _set_mock_create_response_with_fc_tools(httpx_mock): + httpx_mock.add_response( + url=RESPONSES_URL, + method="POST", + json={ + "id": RESPONSE_ID, + "output": [ + { + "type": "function_call", + "id": "fc_67ca09c6bedc8190a7abfec07b1a1332096610f474011cc0", + "call_id": "call_unLAR8MvFNptuiZK6K6HCy5k", + "name": "get_current_weather", + "arguments": '{"location":"San Francisco, MA","unit":"celsius"}', + "status": "completed", + } + ], + "tools": function_tools, + }, + status_code=200, + ) + + +def _set_mock_create_response_with_file_input(httpx_mock): + text = "The file seems to contain excerpts from a letter to the shareholders" + httpx_mock.add_response( + url=RESPONSES_URL, + method="POST", + json={ + "id": RESPONSE_ID, + "output": [ + { + "id": "msg_686ee", + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "annotations": [], + "logprobs": [], + "text": text, + } + ], + "role": "assistant", + } + ], + }, + status_code=200, + ) + + +# +def _set_mock_create_response_with_web_search(httpx_mock): + text = "As of today, Oct 7, 2025, one notable positive news story..." + httpx_mock.add_response( + url=RESPONSES_URL, + method="POST", + json={ + "id": RESPONSE_ID, + "output": [ + {"type": "web_search_call", "id": "ws_67cc", "status": "completed"}, + { + "type": "message", + "id": "msg_67cc", + "status": "completed", + "role": "assistant", + "content": [ + { + "type": "output_text", + "text": text, + "annotations": [ + { + "type": "url_citation", + "start_index": 442, + "end_index": 557, + "url": "https://.../?utm_source=chatgpt.com", + "title": "...", + }, + { + "type": "url_citation", + "start_index": 962, + "end_index": 1077, + "url": "https://.../?utm_source=chatgpt.com", + "title": "...", + }, + ], + } + ], + }, + ], + }, + status_code=200, + ) + + +@pytest.fixture +def oci_openai_client(auth_instance): + """Return a ready OCIOpenAI client for any auth type.""" + client = ChatOCIOpenAI( + auth=auth_instance, + compartment_id=COMPARTMENT_ID, + conversation_store_id=CONVERSATION_STORE_ID, + region=REGION, + model=MODEL, + ) + return client + + +@pytest.mark.requires("langchain_openai") +@pytest.mark.usefixtures("httpx_mock") +def test_client_invoke(httpx_mock, auth_instance, oci_openai_client): + # ---- Arrange ---- + _set_mock_client_invoke_response(httpx_mock=httpx_mock) + messages = [ + ( + "system", + "You are a helpful translator. Translate the user sentence to French.", + ), + ("human", "I love programming."), + ] + + # ---- Act ---- + result = oci_openai_client.invoke(messages) + + # ---- Assert ---- + assert result.content[0]["text"] == "j'adore la programmation" + _assert_common(httpx_mock=httpx_mock) + + +@pytest.mark.requires("langchain_openai") +@pytest.mark.usefixtures("httpx_mock") +def test_prompt_chaining(httpx_mock, auth_instance, oci_openai_client): + # ---- Arrange ---- + message = """ + You are a helpful assistant that translates {input_language} to {output_language}. + """ + _set_mock_client_invoke_response(httpx_mock=httpx_mock) + prompt = ChatPromptTemplate.from_messages( + [ + ( + "system", + message, + ), + ("human", "{input}"), + ] + ) + chain = prompt | oci_openai_client + + # ---- Act ---- + result = chain.invoke( + { + "input_language": "English", + "output_language": "German", + "input": "I love programming.", + } + ) + # ---- Assert ---- + assert result.content[0]["text"] == "j'adore la programmation" + _assert_common(httpx_mock=httpx_mock) + + +@pytest.mark.requires("langchain_openai") +@pytest.mark.usefixtures("httpx_mock") +def test_tools_invoke(httpx_mock, auth_instance, oci_openai_client): + # ---- Arrange ---- + _set_mock_create_response_with_fc_tools(httpx_mock=httpx_mock) + llm_with_tools = oci_openai_client.bind_tools([GetWeather]) + + # ---- Act ---- + ai_msg = llm_with_tools.invoke( + "what is the weather like in San Francisco", + ) + + # ---- Assert ---- + assert ai_msg.content[0]["type"] == "function_call" + assert ai_msg.content[0]["name"] == "get_current_weather" + json.loads((ai_msg.content[0]["arguments"]))["location"] == "San Francisco, MA" + _assert_common(httpx_mock=httpx_mock) + + +@pytest.mark.requires("langchain_openai") +@pytest.mark.usefixtures("httpx_mock") +def test_web_search(httpx_mock, auth_instance, oci_openai_client): + # ---- Arrange ---- + _set_mock_create_response_with_web_search(httpx_mock=httpx_mock) + tool = {"type": "web_search_preview"} + llm_with_tools = oci_openai_client.bind_tools([tool]) + + # ---- Act ---- + response = llm_with_tools.invoke("What was a positive news story from today?") + + # ---- Assert ---- + assert len(response.content) == 2 + assert response.content[0]["type"] == "web_search_call" + assert response.content[1]["type"] == "text" + assert len(response.content[1]["annotations"]) == 2 + _assert_common(httpx_mock=httpx_mock) + + +def _set_mock_client_invoke_response_langgraph(httpx_mock): + httpx_mock.add_response( + url=RESPONSES_URL, + method="POST", + json={ + "id": RESPONSE_ID, + "output": [ + { + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "text": "Paris is the capital of France", + } + ], + } + ], + }, + status_code=200, + ) + + +@pytest.mark.requires("langchain_openai") +@pytest.mark.usefixtures("httpx_mock") +def test_chat_graph(httpx_mock, auth_instance, oci_openai_client): + # ---- Arrange ---- + _set_mock_client_invoke_response_langgraph(httpx_mock=httpx_mock) + + class AgentState(TypedDict): + messages: List[BaseMessage] + + def call_model(state: AgentState): + messages = state["messages"] + response = oci_openai_client.invoke(messages) + return {"messages": messages + [response]} + + workflow = StateGraph(AgentState) + workflow.add_node("llm_node", call_model) + workflow.add_edge(START, "llm_node") + workflow.add_edge("llm_node", END) + + # ---- Act ---- + app = workflow.compile() + input_message = HumanMessage(content="What is the capital of France?") + result = app.invoke({"messages": [input_message]}) + + # ---- Assert ---- + content = result["messages"][1].content[0] + assert content["type"] == "text" + assert content["text"] == "Paris is the capital of France" + _assert_common(httpx_mock=httpx_mock) + + +def test_store_true_with_valid_store_id(): + headers = _build_headers("comp123", conversation_store_id="store456", store=True) + assert headers == { + COMPARTMENT_ID_HEADER: "comp123", + CONVERSATION_STORE_ID_HEADER: "store456", + } + + +def test_store_true_missing_store_id_raises(): + with pytest.raises(ValueError) as excinfo: + _build_headers("comp123", conversation_store_id=None, store=True) + + assert "Conversation Store Id must be provided" in str(excinfo.value) + + +def test_store_default_true_requires_store_id(): + # store defaults to True → should still raise + with pytest.raises(ValueError): + _build_headers("comp123") + + +def test_store_false_ignores_store_id_requirement(): + headers = _build_headers("comp123", conversation_store_id=None, store=False) + assert headers == { + COMPARTMENT_ID_HEADER: "comp123", + } + + +def test_store_false_includes_store_id_if_provided_but_not_required(): + headers = _build_headers("comp123", conversation_store_id="store456", store=False) + # Should NOT include store ID because store=False + assert headers == { + COMPARTMENT_ID_HEADER: "comp123", + } diff --git a/libs/oci/tests/unit_tests/chat_models/test_response_format.py b/libs/oci/tests/unit_tests/chat_models/test_response_format.py index ed0bb70..32cdbe5 100644 --- a/libs/oci/tests/unit_tests/chat_models/test_response_format.py +++ b/libs/oci/tests/unit_tests/chat_models/test_response_format.py @@ -17,7 +17,7 @@ def test_response_format_via_model_kwargs(): model_kwargs={"response_format": {"type": "JSON_OBJECT"}}, client=oci_gen_ai_client, ) - assert llm.model_kwargs["response_format"] == {"type": "JSON_OBJECT"} + assert llm.model_kwargs["response_format"] == {"type": "JSON_OBJECT"} # type: ignore @pytest.mark.requires("oci") @@ -37,8 +37,8 @@ def test_response_format_via_bind(): # Should not raise TypeError anymore llm_with_format = llm.bind(response_format={"type": "JSON_OBJECT"}) - assert "response_format" in llm_with_format.kwargs - assert llm_with_format.kwargs["response_format"] == {"type": "JSON_OBJECT"} + assert "response_format" in llm_with_format.kwargs # type: ignore + assert llm_with_format.kwargs["response_format"] == {"type": "JSON_OBJECT"} # type: ignore @pytest.mark.requires("oci") @@ -51,11 +51,11 @@ def test_response_format_passed_to_api_generic(): llm_with_format = llm.bind(response_format={"type": "JSON_OBJECT"}) # Prepare a request - request = llm_with_format._prepare_request( + request = llm_with_format._prepare_request( # type: ignore [HumanMessage(content="Hello")], stop=None, stream=False, - **llm_with_format.kwargs, + **llm_with_format.kwargs, # type: ignore ) # Verify response_format is in the request @@ -73,11 +73,11 @@ def test_response_format_passed_to_api_cohere(): llm_with_format = llm.bind(response_format={"type": "JSON_OBJECT"}) # Prepare a request - request = llm_with_format._prepare_request( + request = llm_with_format._prepare_request( # type: ignore [HumanMessage(content="Hello")], stop=None, stream=False, - **llm_with_format.kwargs, + **llm_with_format.kwargs, # type: ignore ) # Verify response_format is in the request @@ -149,8 +149,8 @@ def test_response_format_json_schema_object(): llm_with_format = llm.bind(response_format=response_format_obj) # Verify it's stored in kwargs - assert "response_format" in llm_with_format.kwargs - assert llm_with_format.kwargs["response_format"] == response_format_obj + assert "response_format" in llm_with_format.kwargs # type: ignore + assert llm_with_format.kwargs["response_format"] == response_format_obj # type: ignore @pytest.mark.requires("oci")