anaghaj111/codebert-base-code-embed-mrl-langchain-langgraph
090
1---2language:3- en4license: apache-2.05tags:6- sentence-transformers7- sentence-similarity8- feature-extraction9- dense10- generated_from_trainer11- dataset_size:18012- loss:MatryoshkaLoss13- loss:MultipleNegativesRankingLoss14base_model: shubharuidas/codebert-embed-base-dense-retriever15widget:16- source_sentence: Explain the __init__ logic17 sentences:18 - "async def test_handler_with_async_execution() -> None:\n \"\"\"Test handler\19 \ works correctly with async tool execution.\"\"\"\n\n @tool\n def async_add(a:\20 \ int, b: int) -> int:\n \"\"\"Async add two numbers.\"\"\"\n return\21 \ a + b\n\n def modifying_handler(\n request: ToolCallRequest,\n \22 \ execute: Callable[[ToolCallRequest], ToolMessage | Command],\n ) -> ToolMessage\23 \ | Command:\n \"\"\"Handler that modifies arguments.\"\"\"\n #\24 \ Add 10 to both arguments using override method\n modified_call = {\n\25 \ **request.tool_call,\n \"args\": {\n **request.tool_call[\"\26 args\"],\n \"a\": request.tool_call[\"args\"][\"a\"] + 10,\n \27 \ \"b\": request.tool_call[\"args\"][\"b\"] + 10,\n },\n\28 \ }\n modified_request = request.override(tool_call=modified_call)\n\29 \ return execute(modified_request)\n\n tool_node = ToolNode([async_add],\30 \ wrap_tool_call=modifying_handler)\n\n result = await tool_node.ainvoke(\n\31 \ {\n \"messages\": [\n AIMessage(\n \32 \ \"adding\",\n tool_calls=[\n \33 \ {\n \"name\": \"async_add\",\n \34 \ \"args\": {\"a\": 1, \"b\": 2},\n \35 \ \"id\": \"call_13\",\n }\n ],\n \36 \ )\n ]\n },\n config=_create_config_with_runtime(),\n\37 \ )\n\n tool_message = result[\"messages\"][-1]\n assert isinstance(tool_message,\38 \ ToolMessage)\n # Original: 1 + 2 = 3, with modifications: 11 + 12 = 23\n\39 \ assert tool_message.content == \"23\""40 - "def __init__(self) -> None:\n self.loads: set[str] = set()\n self.stores:\41 \ set[str] = set()"42 - "class InternalServerError(APIStatusError):\n pass"43- source_sentence: Explain the async _load_checkpoint_tuple logic44 sentences:45 - 'def task(__func_or_none__: Callable[P, Awaitable[T]]) -> _TaskFunction[P, T]:46 ...'47 - "class State(BaseModel):\n query: str\n inner: InnerObject\n \48 \ answer: str | None = None\n docs: Annotated[list[str], sorted_add]"49 - "async def _load_checkpoint_tuple(self, value: DictRow) -> CheckpointTuple:\n\50 \ \"\"\"\n Convert a database row into a CheckpointTuple object.\n\51 \n Args:\n value: A row from the database containing checkpoint\52 \ data.\n\n Returns:\n CheckpointTuple: A structured representation\53 \ of the checkpoint,\n including its configuration, metadata, parent\54 \ checkpoint (if any),\n and pending writes.\n \"\"\"\n \55 \ return CheckpointTuple(\n {\n \"configurable\"\56 : {\n \"thread_id\": value[\"thread_id\"],\n \57 \ \"checkpoint_ns\": value[\"checkpoint_ns\"],\n \"checkpoint_id\"\58 : value[\"checkpoint_id\"],\n }\n },\n {\n\59 \ **value[\"checkpoint\"],\n \"channel_values\"\60 : {\n **(value[\"checkpoint\"].get(\"channel_values\") or {}),\n\61 \ **self._load_blobs(value[\"channel_values\"]),\n \62 \ },\n },\n value[\"metadata\"],\n (\n\63 \ {\n \"configurable\": {\n \64 \ \"thread_id\": value[\"thread_id\"],\n \"checkpoint_ns\"\65 : value[\"checkpoint_ns\"],\n \"checkpoint_id\": value[\"\66 parent_checkpoint_id\"],\n }\n }\n \67 \ if value[\"parent_checkpoint_id\"]\n else None\n \68 \ ),\n await asyncio.to_thread(self._load_writes, value[\"pending_writes\"\69 ]),\n )"70- source_sentence: Explain the flattened_runs logic71 sentences:72 - "class ChannelWrite(RunnableCallable):\n \"\"\"Implements the logic for sending\73 \ writes to CONFIG_KEY_SEND.\n Can be used as a runnable or as a static method\74 \ to call imperatively.\"\"\"\n\n writes: list[ChannelWriteEntry | ChannelWriteTupleEntry\75 \ | Send]\n \"\"\"Sequence of write entries or Send objects to write.\"\"\"\76 \n\n def __init__(\n self,\n writes: Sequence[ChannelWriteEntry\77 \ | ChannelWriteTupleEntry | Send],\n *,\n tags: Sequence[str] |\78 \ None = None,\n ):\n super().__init__(\n func=self._write,\n\79 \ afunc=self._awrite,\n name=None,\n tags=tags,\n\80 \ trace=False,\n )\n self.writes = cast(\n \81 \ list[ChannelWriteEntry | ChannelWriteTupleEntry | Send], writes\n )\n\82 \n def get_name(self, suffix: str | None = None, *, name: str | None = None)\83 \ -> str:\n if not name:\n name = f\"ChannelWrite<{','.join(w.channel\84 \ if isinstance(w, ChannelWriteEntry) else '...' if isinstance(w, ChannelWriteTupleEntry)\85 \ else w.node for w in self.writes)}>\"\n return super().get_name(suffix,\86 \ name=name)\n\n def _write(self, input: Any, config: RunnableConfig) -> None:\n\87 \ writes = [\n ChannelWriteEntry(write.channel, input, write.skip_none,\88 \ write.mapper)\n if isinstance(write, ChannelWriteEntry) and write.value\89 \ is PASSTHROUGH\n else ChannelWriteTupleEntry(write.mapper, input)\n\90 \ if isinstance(write, ChannelWriteTupleEntry) and write.value is PASSTHROUGH\n\91 \ else write\n for write in self.writes\n ]\n \92 \ self.do_write(\n config,\n writes,\n )\n \93 \ return input\n\n async def _awrite(self, input: Any, config: RunnableConfig)\94 \ -> None:\n writes = [\n ChannelWriteEntry(write.channel, input,\95 \ write.skip_none, write.mapper)\n if isinstance(write, ChannelWriteEntry)\96 \ and write.value is PASSTHROUGH\n else ChannelWriteTupleEntry(write.mapper,\97 \ input)\n if isinstance(write, ChannelWriteTupleEntry) and write.value\98 \ is PASSTHROUGH\n else write\n for write in self.writes\n\99 \ ]\n self.do_write(\n config,\n writes,\n\100 \ )\n return input\n\n @staticmethod\n def do_write(\n \101 \ config: RunnableConfig,\n writes: Sequence[ChannelWriteEntry | ChannelWriteTupleEntry\102 \ | Send],\n allow_passthrough: bool = True,\n ) -> None:\n #\103 \ validate\n for w in writes:\n if isinstance(w, ChannelWriteEntry):\n\104 \ if w.channel == TASKS:\n raise InvalidUpdateError(\n\105 \ \"Cannot write to the reserved channel TASKS\"\n \106 \ )\n if w.value is PASSTHROUGH and not allow_passthrough:\n\107 \ raise InvalidUpdateError(\"PASSTHROUGH value must be replaced\"\108 )\n if isinstance(w, ChannelWriteTupleEntry):\n if w.value\109 \ is PASSTHROUGH and not allow_passthrough:\n raise InvalidUpdateError(\"\110 PASSTHROUGH value must be replaced\")\n # if we want to persist writes\111 \ found before hitting a ParentCommand\n # can move this to a finally block\n\112 \ write: TYPE_SEND = config[CONF][CONFIG_KEY_SEND]\n write(_assemble_writes(writes))\n\113 \n @staticmethod\n def is_writer(runnable: Runnable) -> bool:\n \"\114 \"\"Used by PregelNode to distinguish between writers and other runnables.\"\"\115 \"\n return (\n isinstance(runnable, ChannelWrite)\n \116 \ or getattr(runnable, \"_is_channel_writer\", MISSING) is not MISSING\n \117 \ )\n\n @staticmethod\n def get_static_writes(\n runnable:\118 \ Runnable,\n ) -> Sequence[tuple[str, Any, str | None]] | None:\n \"\119 \"\"Used to get conditional writes a writer declares for static analysis.\"\"\"\120 \n if isinstance(runnable, ChannelWrite):\n return [\n \121 \ w\n for entry in runnable.writes\n if\122 \ isinstance(entry, ChannelWriteTupleEntry) and entry.static\n \123 \ for w in entry.static\n ] or None\n elif writes := getattr(runnable,\124 \ \"_is_channel_writer\", MISSING):\n if writes is not MISSING:\n \125 \ writes = cast(\n Sequence[tuple[ChannelWriteEntry\126 \ | Send, str | None]],\n writes,\n )\n \127 \ entries = [e for e, _ in writes]\n labels = [la for\128 \ _, la in writes]\n return [(*t, la) for t, la in zip(_assemble_writes(entries),\129 \ labels)]\n\n @staticmethod\n def register_writer(\n runnable: R,\n\130 \ static: Sequence[tuple[ChannelWriteEntry | Send, str | None]] | None\131 \ = None,\n ) -> R:\n \"\"\"Used to mark a runnable as a writer, so\132 \ that it can be detected by is_writer.\n Instances of ChannelWrite are\133 \ automatically marked as writers.\n Optionally, a list of declared writes\134 \ can be passed for static analysis.\"\"\"\n # using object.__setattr__\135 \ to work around objects that override __setattr__\n # eg. pydantic models\136 \ and dataclasses\n object.__setattr__(runnable, \"_is_channel_writer\"\137 , static)\n return runnable"138 - "def test_double_interrupt_subgraph(sync_checkpointer: BaseCheckpointSaver) ->\139 \ None:\n class AgentState(TypedDict):\n input: str\n\n def node_1(state:\140 \ AgentState):\n result = interrupt(\"interrupt node 1\")\n return\141 \ {\"input\": result}\n\n def node_2(state: AgentState):\n result =\142 \ interrupt(\"interrupt node 2\")\n return {\"input\": result}\n\n subgraph_builder\143 \ = (\n StateGraph(AgentState)\n .add_node(\"node_1\", node_1)\n\144 \ .add_node(\"node_2\", node_2)\n .add_edge(START, \"node_1\")\n\145 \ .add_edge(\"node_1\", \"node_2\")\n .add_edge(\"node_2\", END)\n\146 \ )\n\n # invoke the sub graph\n subgraph = subgraph_builder.compile(checkpointer=sync_checkpointer)\n\147 \ thread = {\"configurable\": {\"thread_id\": str(uuid.uuid4())}}\n assert\148 \ [c for c in subgraph.stream({\"input\": \"test\"}, thread)] == [\n {\n\149 \ \"__interrupt__\": (\n Interrupt(\n \150 \ value=\"interrupt node 1\",\n id=AnyStr(),\n \151 \ ),\n )\n },\n ]\n # resume from the first interrupt\n\152 \ assert [c for c in subgraph.stream(Command(resume=\"123\"), thread)] == [\n\153 \ {\n \"node_1\": {\"input\": \"123\"},\n },\n \154 \ {\n \"__interrupt__\": (\n Interrupt(\n \155 \ value=\"interrupt node 2\",\n id=AnyStr(),\n \156 \ ),\n )\n },\n ]\n # resume from the second\157 \ interrupt\n assert [c for c in subgraph.stream(Command(resume=\"123\"), thread)]\158 \ == [\n {\n \"node_2\": {\"input\": \"123\"},\n },\n\159 \ ]\n\n subgraph = subgraph_builder.compile()\n\n def invoke_sub_agent(state:\160 \ AgentState):\n return subgraph.invoke(state)\n\n thread = {\"configurable\"\161 : {\"thread_id\": str(uuid.uuid4())}}\n parent_agent = (\n StateGraph(AgentState)\n\162 \ .add_node(\"invoke_sub_agent\", invoke_sub_agent)\n .add_edge(START,\163 \ \"invoke_sub_agent\")\n .add_edge(\"invoke_sub_agent\", END)\n \164 \ .compile(checkpointer=sync_checkpointer)\n )\n\n assert [c for c in parent_agent.stream({\"\165 input\": \"test\"}, thread)] == [\n {\n \"__interrupt__\": (\n\166 \ Interrupt(\n value=\"interrupt node 1\",\n\167 \ id=AnyStr(),\n ),\n )\n \168 \ },\n ]\n\n # resume from the first interrupt\n assert [c for c in parent_agent.stream(Command(resume=True),\169 \ thread)] == [\n {\n \"__interrupt__\": (\n \170 \ Interrupt(\n value=\"interrupt node 2\",\n \171 \ id=AnyStr(),\n ),\n )\n }\n ]\n\n \172 \ # resume from 2nd interrupt\n assert [c for c in parent_agent.stream(Command(resume=True),\173 \ thread)] == [\n {\n \"invoke_sub_agent\": {\"input\": True},\n\174 \ },\n ]"175 - "def flattened_runs(self) -> list[Run]:\n q = [] + self.runs\n result\176 \ = []\n while q:\n parent = q.pop()\n result.append(parent)\n\177 \ if parent.child_runs:\n q.extend(parent.child_runs)\n\178 \ return result"179- source_sentence: Explain the SubGraphState logic180 sentences:181 - "class Cron(TypedDict):\n \"\"\"Represents a scheduled task.\"\"\"\n\n cron_id:\182 \ str\n \"\"\"The ID of the cron.\"\"\"\n assistant_id: str\n \"\"\"\183 The ID of the assistant.\"\"\"\n thread_id: str | None\n \"\"\"The ID of\184 \ the thread.\"\"\"\n on_run_completed: OnCompletionBehavior | None\n \"\185 \"\"What to do with the thread after the run completes. Only applicable for stateless\186 \ crons.\"\"\"\n end_time: datetime | None\n \"\"\"The end date to stop\187 \ running the cron.\"\"\"\n schedule: str\n \"\"\"The schedule to run, cron\188 \ format.\"\"\"\n created_at: datetime\n \"\"\"The time the cron was created.\"\189 \"\"\n updated_at: datetime\n \"\"\"The last time the cron was updated.\"\190 \"\"\n payload: dict\n \"\"\"The run payload to use for creating new run.\"\191 \"\"\n user_id: str | None\n \"\"\"The user ID of the cron.\"\"\"\n next_run_date:\192 \ datetime | None\n \"\"\"The next run date of the cron.\"\"\"\n metadata:\193 \ dict\n \"\"\"The metadata of the cron.\"\"\""194 - "class SubGraphState(MessagesState):\n city: str"195 - "def task_path_str(tup: str | int | tuple) -> str:\n \"\"\"Generate a string\196 \ representation of the task path.\"\"\"\n return (\n f\"~{', '.join(task_path_str(x)\197 \ for x in tup)}\"\n if isinstance(tup, (tuple, list))\n else f\"\198 {tup:010d}\"\n if isinstance(tup, int)\n else str(tup)\n )"199- source_sentence: Best practices for test_list_namespaces_operations200 sentences:201 - "def test_doubly_nested_graph_state(\n sync_checkpointer: BaseCheckpointSaver,\n\202 ) -> None:\n class State(TypedDict):\n my_key: str\n\n class ChildState(TypedDict):\n\203 \ my_key: str\n\n class GrandChildState(TypedDict):\n my_key:\204 \ str\n\n def grandchild_1(state: ChildState):\n return {\"my_key\"\205 : state[\"my_key\"] + \" here\"}\n\n def grandchild_2(state: ChildState):\n\206 \ return {\n \"my_key\": state[\"my_key\"] + \" and there\"\207 ,\n }\n\n grandchild = StateGraph(GrandChildState)\n grandchild.add_node(\"\208 grandchild_1\", grandchild_1)\n grandchild.add_node(\"grandchild_2\", grandchild_2)\n\209 \ grandchild.add_edge(\"grandchild_1\", \"grandchild_2\")\n grandchild.set_entry_point(\"\210 grandchild_1\")\n grandchild.set_finish_point(\"grandchild_2\")\n\n child\211 \ = StateGraph(ChildState)\n child.add_node(\n \"child_1\",\n \212 \ grandchild.compile(interrupt_before=[\"grandchild_2\"]),\n )\n child.set_entry_point(\"\213 child_1\")\n child.set_finish_point(\"child_1\")\n\n def parent_1(state:\214 \ State):\n return {\"my_key\": \"hi \" + state[\"my_key\"]}\n\n def\215 \ parent_2(state: State):\n return {\"my_key\": state[\"my_key\"] + \"\216 \ and back again\"}\n\n graph = StateGraph(State)\n graph.add_node(\"parent_1\"\217 , parent_1)\n graph.add_node(\"child\", child.compile())\n graph.add_node(\"\218 parent_2\", parent_2)\n graph.set_entry_point(\"parent_1\")\n graph.add_edge(\"\219 parent_1\", \"child\")\n graph.add_edge(\"child\", \"parent_2\")\n graph.set_finish_point(\"\220 parent_2\")\n\n app = graph.compile(checkpointer=sync_checkpointer)\n\n \221 \ # test invoke w/ nested interrupt\n config = {\"configurable\": {\"thread_id\"\222 : \"1\"}}\n assert [\n c\n for c in app.stream(\n \223 \ {\"my_key\": \"my value\"}, config, subgraphs=True, durability=\"exit\"\n \224 \ )\n ] == [\n ((), {\"parent_1\": {\"my_key\": \"hi my value\"\225 }}),\n (\n (AnyStr(\"child:\"), AnyStr(\"child_1:\")),\n \226 \ {\"grandchild_1\": {\"my_key\": \"hi my value here\"}},\n ),\n\227 \ ((), {\"__interrupt__\": ()}),\n ]\n # get state without subgraphs\n\228 \ outer_state = app.get_state(config)\n assert outer_state == StateSnapshot(\n\229 \ values={\"my_key\": \"hi my value\"},\n tasks=(\n PregelTask(\n\230 \ AnyStr(),\n \"child\",\n (PULL,\231 \ \"child\"),\n state={\n \"configurable\":\232 \ {\n \"thread_id\": \"1\",\n \"\233 checkpoint_ns\": AnyStr(\"child\"),\n }\n },\n\234 \ ),\n ),\n next=(\"child\",),\n config={\n \235 \ \"configurable\": {\n \"thread_id\": \"1\",\n \236 \ \"checkpoint_ns\": \"\",\n \"checkpoint_id\": AnyStr(),\n\237 \ }\n },\n metadata={\n \"parents\": {},\n\238 \ \"source\": \"loop\",\n \"step\": 1,\n },\n \239 \ created_at=AnyStr(),\n parent_config=None,\n interrupts=(),\n\240 \ )\n child_state = app.get_state(outer_state.tasks[0].state)\n assert\241 \ child_state == StateSnapshot(\n values={\"my_key\": \"hi my value\"},\n\242 \ tasks=(\n PregelTask(\n AnyStr(),\n \243 \ \"child_1\",\n (PULL, \"child_1\"),\n \244 \ state={\n \"configurable\": {\n \"\245 thread_id\": \"1\",\n \"checkpoint_ns\": AnyStr(),\n \246 \ }\n },\n ),\n ),\n \247 \ next=(\"child_1\",),\n config={\n \"configurable\": {\n \248 \ \"thread_id\": \"1\",\n \"checkpoint_ns\": AnyStr(\"\249 child:\"),\n \"checkpoint_id\": AnyStr(),\n \"checkpoint_map\"\250 : AnyDict(\n {\n \"\": AnyStr(),\n \251 \ AnyStr(\"child:\"): AnyStr(),\n }\n\252 \ ),\n }\n },\n metadata={\n \253 \ \"parents\": {\"\": AnyStr()},\n \"source\": \"loop\",\n \254 \ \"step\": 0,\n },\n created_at=AnyStr(),\n parent_config=None,\n\255 \ interrupts=(),\n )\n grandchild_state = app.get_state(child_state.tasks[0].state)\n\256 \ assert grandchild_state == StateSnapshot(\n values={\"my_key\": \"\257 hi my value here\"},\n tasks=(\n PregelTask(\n \258 \ AnyStr(),\n \"grandchild_2\",\n (PULL, \"grandchild_2\"\259 ),\n ),\n ),\n next=(\"grandchild_2\",),\n config={\n\260 \ \"configurable\": {\n \"thread_id\": \"1\",\n \261 \ \"checkpoint_ns\": AnyStr(),\n \"checkpoint_id\":\262 \ AnyStr(),\n \"checkpoint_map\": AnyDict(\n \263 \ {\n \"\": AnyStr(),\n AnyStr(\"\264 child:\"): AnyStr(),\n AnyStr(re.compile(r\"child:.+|child1:\"\265 )): AnyStr(),\n }\n ),\n }\n \266 \ },\n metadata={\n \"parents\": AnyDict(\n \267 \ {\n \"\": AnyStr(),\n AnyStr(\"child:\"\268 ): AnyStr(),\n }\n ),\n \"source\": \"loop\"\269 ,\n \"step\": 1,\n },\n created_at=AnyStr(),\n \270 \ parent_config=None,\n interrupts=(),\n )\n # get state with subgraphs\n\271 \ assert app.get_state(config, subgraphs=True) == StateSnapshot(\n values={\"\272 my_key\": \"hi my value\"},\n tasks=(\n PregelTask(\n \273 \ AnyStr(),\n \"child\",\n (PULL, \"child\"\274 ),\n state=StateSnapshot(\n values={\"my_key\"\275 : \"hi my value\"},\n tasks=(\n PregelTask(\n\276 \ AnyStr(),\n \"child_1\"\277 ,\n (PULL, \"child_1\"),\n \278 \ state=StateSnapshot(\n values={\"my_key\"\279 : \"hi my value here\"},\n tasks=(\n \280 \ PregelTask(\n \281 \ AnyStr(),\n \"grandchild_2\",\n \282 \ (PULL, \"grandchild_2\"),\n \283 \ ),\n ),\n \284 \ next=(\"grandchild_2\",),\n \285 \ config={\n \"configurable\": {\n \286 \ \"thread_id\": \"1\",\n \287 \ \"checkpoint_ns\": AnyStr(),\n \288 \ \"checkpoint_id\": AnyStr(),\n \289 \ \"checkpoint_map\": AnyDict(\n \290 \ {\n \"\": AnyStr(),\n \291 \ AnyStr(\"child:\"): AnyStr(),\n\292 \ AnyStr(\n \293 \ re.compile(r\"child:.+|child1:\")\n \294 \ ): AnyStr(),\n \295 \ }\n ),\n \296 \ }\n },\n \297 \ metadata={\n \"parents\"\298 : AnyDict(\n {\n \299 \ \"\": AnyStr(),\n \300 \ AnyStr(\"child:\"): AnyStr(),\n \301 \ }\n ),\n \302 \ \"source\": \"loop\",\n \"step\": 1,\n\303 \ },\n created_at=AnyStr(),\n\304 \ parent_config=None,\n \305 \ interrupts=(),\n ),\n \306 \ ),\n ),\n next=(\"child_1\",),\n \307 \ config={\n \"configurable\": {\n \308 \ \"thread_id\": \"1\",\n \309 \ \"checkpoint_ns\": AnyStr(\"child:\"),\n \"checkpoint_id\"\310 : AnyStr(),\n \"checkpoint_map\": AnyDict(\n \311 \ {\"\": AnyStr(), AnyStr(\"child:\"): AnyStr()}\n \312 \ ),\n }\n \313 \ },\n metadata={\n \"parents\": {\"\314 \": AnyStr()},\n \"source\": \"loop\",\n \315 \ \"step\": 0,\n },\n created_at=AnyStr(),\n\316 \ parent_config=None,\n interrupts=(),\n\317 \ ),\n ),\n ),\n next=(\"child\",),\n\318 \ config={\n \"configurable\": {\n \"thread_id\"\319 : \"1\",\n \"checkpoint_ns\": \"\",\n \"checkpoint_id\"\320 : AnyStr(),\n }\n },\n metadata={\n \"parents\"\321 : {},\n \"source\": \"loop\",\n \"step\": 1,\n },\n\322 \ created_at=AnyStr(),\n parent_config=None,\n interrupts=(),\n\323 \ )\n # # resume\n assert [c for c in app.stream(None, config, subgraphs=True,\324 \ durability=\"exit\")] == [\n (\n (AnyStr(\"child:\"), AnyStr(\"\325 child_1:\")),\n {\"grandchild_2\": {\"my_key\": \"hi my value here\326 \ and there\"}},\n ),\n ((AnyStr(\"child:\"),), {\"child_1\": {\"\327 my_key\": \"hi my value here and there\"}}),\n ((), {\"child\": {\"my_key\"\328 : \"hi my value here and there\"}}),\n ((), {\"parent_2\": {\"my_key\"\329 : \"hi my value here and there and back again\"}}),\n ]\n # get state with\330 \ and without subgraphs\n assert (\n app.get_state(config)\n \331 \ == app.get_state(config, subgraphs=True)\n == StateSnapshot(\n \332 \ values={\"my_key\": \"hi my value here and there and back again\"},\n \333 \ tasks=(),\n next=(),\n config={\n \334 \ \"configurable\": {\n \"thread_id\": \"1\",\n \335 \ \"checkpoint_ns\": \"\",\n \"checkpoint_id\"\336 : AnyStr(),\n }\n },\n metadata={\n \337 \ \"parents\": {},\n \"source\": \"loop\",\n \338 \ \"step\": 3,\n },\n created_at=AnyStr(),\n \339 \ parent_config=(\n {\n \"configurable\"\340 : {\n \"thread_id\": \"1\",\n \"\341 checkpoint_ns\": \"\",\n \"checkpoint_id\": AnyStr(),\n\342 \ }\n }\n ),\n interrupts=(),\n\343 \ )\n )\n\n # get outer graph history\n outer_history = list(app.get_state_history(config))\n\344 \ assert outer_history == [\n StateSnapshot(\n values={\"\345 my_key\": \"hi my value here and there and back again\"},\n tasks=(),\n\346 \ next=(),\n config={\n \"configurable\"\347 : {\n \"thread_id\": \"1\",\n \"checkpoint_ns\"\348 : \"\",\n \"checkpoint_id\": AnyStr(),\n }\n\349 \ },\n metadata={\n \"parents\": {},\n \350 \ \"source\": \"loop\",\n \"step\": 3,\n \351 \ },\n created_at=AnyStr(),\n parent_config={\n \352 \ \"configurable\": {\n \"thread_id\": \"1\",\n \353 \ \"checkpoint_ns\": \"\",\n \"checkpoint_id\"\354 : AnyStr(),\n }\n },\n interrupts=(),\n \355 \ ),\n StateSnapshot(\n values={\"my_key\": \"hi my value\"\356 },\n tasks=(\n PregelTask(\n AnyStr(),\n\357 \ \"child\",\n (PULL, \"child\"),\n \358 \ state={\n \"configurable\": {\n \359 \ \"thread_id\": \"1\",\n \"checkpoint_ns\"\360 : AnyStr(\"child\"),\n }\n },\n \361 \ result=None,\n ),\n ),\n \362 \ next=(\"child\",),\n config={\n \"configurable\"\363 : {\n \"thread_id\": \"1\",\n \"checkpoint_ns\"\364 : \"\",\n \"checkpoint_id\": AnyStr(),\n }\n\365 \ },\n metadata={\n \"parents\": {},\n \366 \ \"source\": \"loop\",\n \"step\": 1,\n \367 \ },\n created_at=AnyStr(),\n parent_config=None,\n \368 \ interrupts=(),\n ),\n ]\n # get child graph history\n\369 \ child_history = list(app.get_state_history(outer_history[1].tasks[0].state))\n\370 \ assert child_history == [\n StateSnapshot(\n values={\"\371 my_key\": \"hi my value\"},\n next=(\"child_1\",),\n config={\n\372 \ \"configurable\": {\n \"thread_id\": \"1\"\373 ,\n \"checkpoint_ns\": AnyStr(\"child:\"),\n \374 \ \"checkpoint_id\": AnyStr(),\n \"checkpoint_map\": AnyDict(\n\375 \ {\"\": AnyStr(), AnyStr(\"child:\"): AnyStr()}\n \376 \ ),\n }\n },\n metadata={\n\377 \ \"source\": \"loop\",\n \"step\": 0,\n \378 \ \"parents\": {\"\": AnyStr()},\n },\n created_at=AnyStr(),\n\379 \ parent_config=None,\n tasks=(\n PregelTask(\n\380 \ id=AnyStr(),\n name=\"child_1\",\n \381 \ path=(PULL, \"child_1\"),\n state={\n \382 \ \"configurable\": {\n \"thread_id\"\383 : \"1\",\n \"checkpoint_ns\": AnyStr(\"child:\"),\n\384 \ }\n },\n result=None,\n\385 \ ),\n ),\n interrupts=(),\n ),\n\386 \ ]\n # get grandchild graph history\n grandchild_history = list(app.get_state_history(child_history[0].tasks[0].state))\n\387 \ assert grandchild_history == [\n StateSnapshot(\n values={\"\388 my_key\": \"hi my value here\"},\n next=(\"grandchild_2\",),\n \389 \ config={\n \"configurable\": {\n \"\390 thread_id\": \"1\",\n \"checkpoint_ns\": AnyStr(),\n \391 \ \"checkpoint_id\": AnyStr(),\n \"checkpoint_map\"\392 : AnyDict(\n {\n \"\": AnyStr(),\n\393 \ AnyStr(\"child:\"): AnyStr(),\n \394 \ AnyStr(re.compile(r\"child:.+|child1:\")): AnyStr(),\n \395 \ }\n ),\n }\n },\n \396 \ metadata={\n \"source\": \"loop\",\n \397 \ \"step\": 1,\n \"parents\": AnyDict(\n {\n\398 \ \"\": AnyStr(),\n AnyStr(\"child:\"\399 ): AnyStr(),\n }\n ),\n },\n \400 \ created_at=AnyStr(),\n parent_config=None,\n tasks=(\n\401 \ PregelTask(\n id=AnyStr(),\n \402 \ name=\"grandchild_2\",\n path=(PULL, \"grandchild_2\"\403 ),\n result=None,\n ),\n ),\n \404 \ interrupts=(),\n ),\n ]"405 - "def _msgpack_enc(data: Any) -> bytes:\n return ormsgpack.packb(data, default=_msgpack_default,\406 \ option=_option)"407 - "def test_list_namespaces_operations(\n fake_embeddings: CharacterEmbeddings,\n\408 ) -> None:\n \"\"\"Test list namespaces functionality with various filters.\"\409 \"\"\n with create_vector_store(\n fake_embeddings, text_fields=[\"\410 key0\", \"key1\", \"key3\"]\n ) as store:\n test_pref = str(uuid.uuid4())\n\411 \ test_namespaces = [\n (test_pref, \"test\", \"documents\"\412 , \"public\", test_pref),\n (test_pref, \"test\", \"documents\", \"\413 private\", test_pref),\n (test_pref, \"test\", \"images\", \"public\"\414 , test_pref),\n (test_pref, \"test\", \"images\", \"private\", test_pref),\n\415 \ (test_pref, \"prod\", \"documents\", \"public\", test_pref),\n \416 \ (test_pref, \"prod\", \"documents\", \"some\", \"nesting\", \"public\"\417 , test_pref),\n (test_pref, \"prod\", \"documents\", \"private\", test_pref),\n\418 \ ]\n\n # Add test data\n for namespace in test_namespaces:\n\419 \ store.put(namespace, \"dummy\", {\"content\": \"dummy\"})\n\n \420 \ # Test prefix filtering\n prefix_result = store.list_namespaces(prefix=(test_pref,\421 \ \"test\"))\n assert len(prefix_result) == 4\n assert all(ns[1]\422 \ == \"test\" for ns in prefix_result)\n\n # Test specific prefix\n \423 \ specific_prefix_result = store.list_namespaces(\n prefix=(test_pref,\424 \ \"test\", \"documents\")\n )\n assert len(specific_prefix_result)\425 \ == 2\n assert all(ns[1:3] == (\"test\", \"documents\") for ns in specific_prefix_result)\n\426 \n # Test suffix filtering\n suffix_result = store.list_namespaces(suffix=(\"\427 public\", test_pref))\n assert len(suffix_result) == 4\n assert\428 \ all(ns[-2] == \"public\" for ns in suffix_result)\n\n # Test combined\429 \ prefix and suffix\n prefix_suffix_result = store.list_namespaces(\n \430 \ prefix=(test_pref, \"test\"), suffix=(\"public\", test_pref)\n \431 \ )\n assert len(prefix_suffix_result) == 2\n assert all(\n\432 \ ns[1] == \"test\" and ns[-2] == \"public\" for ns in prefix_suffix_result\n\433 \ )\n\n # Test wildcard in prefix\n wildcard_prefix_result\434 \ = store.list_namespaces(\n prefix=(test_pref, \"*\", \"documents\"\435 )\n )\n assert len(wildcard_prefix_result) == 5\n assert\436 \ all(ns[2] == \"documents\" for ns in wildcard_prefix_result)\n\n # Test\437 \ wildcard in suffix\n wildcard_suffix_result = store.list_namespaces(\n\438 \ suffix=(\"*\", \"public\", test_pref)\n )\n assert\439 \ len(wildcard_suffix_result) == 4\n assert all(ns[-2] == \"public\" for\440 \ ns in wildcard_suffix_result)\n\n wildcard_single = store.list_namespaces(\n\441 \ suffix=(\"some\", \"*\", \"public\", test_pref)\n )\n \442 \ assert len(wildcard_single) == 1\n assert wildcard_single[0] == (\n\443 \ test_pref,\n \"prod\",\n \"documents\",\n \444 \ \"some\",\n \"nesting\",\n \"public\",\n \445 \ test_pref,\n )\n\n # Test max depth\n max_depth_result\446 \ = store.list_namespaces(max_depth=3)\n assert all(len(ns) <= 3 for ns\447 \ in max_depth_result)\n\n max_depth_result = store.list_namespaces(\n\448 \ max_depth=4, prefix=(test_pref, \"*\", \"documents\")\n )\n\449 \ assert len(set(res for res in max_depth_result)) == len(max_depth_result)\450 \ == 5\n\n # Test pagination\n limit_result = store.list_namespaces(prefix=(test_pref,),\451 \ limit=3)\n assert len(limit_result) == 3\n\n offset_result = store.list_namespaces(prefix=(test_pref,),\452 \ offset=3)\n assert len(offset_result) == len(test_namespaces) - 3\n\n\453 \ empty_prefix_result = store.list_namespaces(prefix=(test_pref,))\n \454 \ assert len(empty_prefix_result) == len(test_namespaces)\n assert\455 \ set(empty_prefix_result) == set(test_namespaces)\n\n # Clean up\n \456 \ for namespace in test_namespaces:\n store.delete(namespace, \"\457 dummy\")"458pipeline_tag: sentence-similarity459library_name: sentence-transformers460metrics:461- cosine_accuracy@1462- cosine_accuracy@3463- cosine_accuracy@5464- cosine_accuracy@10465- cosine_precision@1466- cosine_precision@3467- cosine_precision@5468- cosine_precision@10469- cosine_recall@1470- cosine_recall@3471- cosine_recall@5472- cosine_recall@10473- cosine_ndcg@10474- cosine_mrr@10475- cosine_map@100476model-index:477- name: codeBert dense retriever478 results:479 - task:480 type: information-retrieval481 name: Information Retrieval482 dataset:483 name: dim 768484 type: dim_768485 metrics:486 - type: cosine_accuracy@1487 value: 0.9488 name: Cosine Accuracy@1489 - type: cosine_accuracy@3490 value: 0.9491 name: Cosine Accuracy@3492 - type: cosine_accuracy@5493 value: 1.0494 name: Cosine Accuracy@5495 - type: cosine_accuracy@10496 value: 1.0497 name: Cosine Accuracy@10498 - type: cosine_precision@1499 value: 0.9500 name: Cosine Precision@1501 - type: cosine_precision@3502 value: 0.29999999999999993503 name: Cosine Precision@3504 - type: cosine_precision@5505 value: 0.20000000000000004506 name: Cosine Precision@5507 - type: cosine_precision@10508 value: 0.10000000000000002509 name: Cosine Precision@10510 - type: cosine_recall@1511 value: 0.9512 name: Cosine Recall@1513 - type: cosine_recall@3514 value: 0.9515 name: Cosine Recall@3516 - type: cosine_recall@5517 value: 1.0518 name: Cosine Recall@5519 - type: cosine_recall@10520 value: 1.0521 name: Cosine Recall@10522 - type: cosine_ndcg@10523 value: 0.9408764682653967524 name: Cosine Ndcg@10525 - type: cosine_mrr@10526 value: 0.9225527 name: Cosine Mrr@10528 - type: cosine_map@100529 value: 0.9225530 name: Cosine Map@100531 - task:532 type: information-retrieval533 name: Information Retrieval534 dataset:535 name: dim 512536 type: dim_512537 metrics:538 - type: cosine_accuracy@1539 value: 0.9540 name: Cosine Accuracy@1541 - type: cosine_accuracy@3542 value: 0.9543 name: Cosine Accuracy@3544 - type: cosine_accuracy@5545 value: 1.0546 name: Cosine Accuracy@5547 - type: cosine_accuracy@10548 value: 1.0549 name: Cosine Accuracy@10550 - type: cosine_precision@1551 value: 0.9552 name: Cosine Precision@1553 - type: cosine_precision@3554 value: 0.29999999999999993555 name: Cosine Precision@3556 - type: cosine_precision@5557 value: 0.20000000000000004558 name: Cosine Precision@5559 - type: cosine_precision@10560 value: 0.10000000000000002561 name: Cosine Precision@10562 - type: cosine_recall@1563 value: 0.9564 name: Cosine Recall@1565 - type: cosine_recall@3566 value: 0.9567 name: Cosine Recall@3568 - type: cosine_recall@5569 value: 1.0570 name: Cosine Recall@5571 - type: cosine_recall@10572 value: 1.0573 name: Cosine Recall@10574 - type: cosine_ndcg@10575 value: 0.9408764682653967576 name: Cosine Ndcg@10577 - type: cosine_mrr@10578 value: 0.9225579 name: Cosine Mrr@10580 - type: cosine_map@100581 value: 0.9225582 name: Cosine Map@100583 - task:584 type: information-retrieval585 name: Information Retrieval586 dataset:587 name: dim 256588 type: dim_256589 metrics:590 - type: cosine_accuracy@1591 value: 0.9592 name: Cosine Accuracy@1593 - type: cosine_accuracy@3594 value: 0.9595 name: Cosine Accuracy@3596 - type: cosine_accuracy@5597 value: 1.0598 name: Cosine Accuracy@5599 - type: cosine_accuracy@10600 value: 1.0601 name: Cosine Accuracy@10602 - type: cosine_precision@1603 value: 0.9604 name: Cosine Precision@1605 - type: cosine_precision@3606 value: 0.29999999999999993607 name: Cosine Precision@3608 - type: cosine_precision@5609 value: 0.20000000000000004610 name: Cosine Precision@5611 - type: cosine_precision@10612 value: 0.10000000000000002613 name: Cosine Precision@10614 - type: cosine_recall@1615 value: 0.9616 name: Cosine Recall@1617 - type: cosine_recall@3618 value: 0.9619 name: Cosine Recall@3620 - type: cosine_recall@5621 value: 1.0622 name: Cosine Recall@5623 - type: cosine_recall@10624 value: 1.0625 name: Cosine Recall@10626 - type: cosine_ndcg@10627 value: 0.9408764682653967628 name: Cosine Ndcg@10629 - type: cosine_mrr@10630 value: 0.9225631 name: Cosine Mrr@10632 - type: cosine_map@100633 value: 0.9225634 name: Cosine Map@100635 - task:636 type: information-retrieval637 name: Information Retrieval638 dataset:639 name: dim 128640 type: dim_128641 metrics:642 - type: cosine_accuracy@1643 value: 0.85644 name: Cosine Accuracy@1645 - type: cosine_accuracy@3646 value: 0.9647 name: Cosine Accuracy@3648 - type: cosine_accuracy@5649 value: 0.95650 name: Cosine Accuracy@5651 - type: cosine_accuracy@10652 value: 0.95653 name: Cosine Accuracy@10654 - type: cosine_precision@1655 value: 0.85656 name: Cosine Precision@1657 - type: cosine_precision@3658 value: 0.29999999999999993659 name: Cosine Precision@3660 - type: cosine_precision@5661 value: 0.19000000000000003662 name: Cosine Precision@5663 - type: cosine_precision@10664 value: 0.09500000000000001665 name: Cosine Precision@10666 - type: cosine_recall@1667 value: 0.85668 name: Cosine Recall@1669 - type: cosine_recall@3670 value: 0.9671 name: Cosine Recall@3672 - type: cosine_recall@5673 value: 0.95674 name: Cosine Recall@5675 - type: cosine_recall@10676 value: 0.95677 name: Cosine Recall@10678 - type: cosine_ndcg@10679 value: 0.894342640361727680 name: Cosine Ndcg@10681 - type: cosine_mrr@10682 value: 0.8766666666666666683 name: Cosine Mrr@10684 - type: cosine_map@100685 value: 0.8799999999999999686 name: Cosine Map@100687 - task:688 type: information-retrieval689 name: Information Retrieval690 dataset:691 name: dim 64692 type: dim_64693 metrics:694 - type: cosine_accuracy@1695 value: 0.85696 name: Cosine Accuracy@1697 - type: cosine_accuracy@3698 value: 0.9699 name: Cosine Accuracy@3700 - type: cosine_accuracy@5701 value: 0.9702 name: Cosine Accuracy@5703 - type: cosine_accuracy@10704 value: 1.0705 name: Cosine Accuracy@10706 - type: cosine_precision@1707 value: 0.85708 name: Cosine Precision@1709 - type: cosine_precision@3710 value: 0.29999999999999993711 name: Cosine Precision@3712 - type: cosine_precision@5713 value: 0.18000000000000005714 name: Cosine Precision@5715 - type: cosine_precision@10716 value: 0.10000000000000002717 name: Cosine Precision@10718 - type: cosine_recall@1719 value: 0.85720 name: Cosine Recall@1721 - type: cosine_recall@3722 value: 0.9723 name: Cosine Recall@3724 - type: cosine_recall@5725 value: 0.9726 name: Cosine Recall@5727 - type: cosine_recall@10728 value: 1.0729 name: Cosine Recall@10730 - type: cosine_ndcg@10731 value: 0.9074399105059531732 name: Cosine Ndcg@10733 - type: cosine_mrr@10734 value: 0.8800595238095237735 name: Cosine Mrr@10736 - type: cosine_map@100737 value: 0.8800595238095237738 name: Cosine Map@100739---740 741# codeBert dense retriever742 743This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [shubharuidas/codebert-embed-base-dense-retriever](https://huggingface.co/shubharuidas/codebert-embed-base-dense-retriever). It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.744 745## Model Details746 747### Model Description748- **Model Type:** Sentence Transformer749- **Base model:** [shubharuidas/codebert-embed-base-dense-retriever](https://huggingface.co/shubharuidas/codebert-embed-base-dense-retriever) <!-- at revision 9594580ae943039d0b85feb304404f9b2bb203ce -->750- **Maximum Sequence Length:** 512 tokens751- **Output Dimensionality:** 768 dimensions752- **Similarity Function:** Cosine Similarity753<!-- - **Training Dataset:** Unknown -->754- **Language:** en755- **License:** apache-2.0756 757### Model Sources758 759- **Documentation:** [Sentence Transformers Documentation](https://sbert.net)760- **Repository:** [Sentence Transformers on GitHub](https://github.com/huggingface/sentence-transformers)761- **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)762 763### Full Model Architecture764 765```766SentenceTransformer(767 (0): Transformer({'max_seq_length': 512, 'do_lower_case': False, 'architecture': 'RobertaModel'})768 (1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})769)770```771 772## Usage773 774### Direct Usage (Sentence Transformers)775 776First install the Sentence Transformers library:777 778```bash779pip install -U sentence-transformers780```781 782Then you can load this model and run inference.783```python784from sentence_transformers import SentenceTransformer785 786# Download from the ๐ค Hub787model = SentenceTransformer("anaghaj111/codebert-base-code-embed-mrl-langchain-langgraph")788# Run inference789sentences = [790 'Best practices for test_list_namespaces_operations',791 'def test_list_namespaces_operations(\n fake_embeddings: CharacterEmbeddings,\n) -> None:\n """Test list namespaces functionality with various filters."""\n with create_vector_store(\n fake_embeddings, text_fields=["key0", "key1", "key3"]\n ) as store:\n test_pref = str(uuid.uuid4())\n test_namespaces = [\n (test_pref, "test", "documents", "public", test_pref),\n (test_pref, "test", "documents", "private", test_pref),\n (test_pref, "test", "images", "public", test_pref),\n (test_pref, "test", "images", "private", test_pref),\n (test_pref, "prod", "documents", "public", test_pref),\n (test_pref, "prod", "documents", "some", "nesting", "public", test_pref),\n (test_pref, "prod", "documents", "private", test_pref),\n ]\n\n # Add test data\n for namespace in test_namespaces:\n store.put(namespace, "dummy", {"content": "dummy"})\n\n # Test prefix filtering\n prefix_result = store.list_namespaces(prefix=(test_pref, "test"))\n assert len(prefix_result) == 4\n assert all(ns[1] == "test" for ns in prefix_result)\n\n # Test specific prefix\n specific_prefix_result = store.list_namespaces(\n prefix=(test_pref, "test", "documents")\n )\n assert len(specific_prefix_result) == 2\n assert all(ns[1:3] == ("test", "documents") for ns in specific_prefix_result)\n\n # Test suffix filtering\n suffix_result = store.list_namespaces(suffix=("public", test_pref))\n assert len(suffix_result) == 4\n assert all(ns[-2] == "public" for ns in suffix_result)\n\n # Test combined prefix and suffix\n prefix_suffix_result = store.list_namespaces(\n prefix=(test_pref, "test"), suffix=("public", test_pref)\n )\n assert len(prefix_suffix_result) == 2\n assert all(\n ns[1] == "test" and ns[-2] == "public" for ns in prefix_suffix_result\n )\n\n # Test wildcard in prefix\n wildcard_prefix_result = store.list_namespaces(\n prefix=(test_pref, "*", "documents")\n )\n assert len(wildcard_prefix_result) == 5\n assert all(ns[2] == "documents" for ns in wildcard_prefix_result)\n\n # Test wildcard in suffix\n wildcard_suffix_result = store.list_namespaces(\n suffix=("*", "public", test_pref)\n )\n assert len(wildcard_suffix_result) == 4\n assert all(ns[-2] == "public" for ns in wildcard_suffix_result)\n\n wildcard_single = store.list_namespaces(\n suffix=("some", "*", "public", test_pref)\n )\n assert len(wildcard_single) == 1\n assert wildcard_single[0] == (\n test_pref,\n "prod",\n "documents",\n "some",\n "nesting",\n "public",\n test_pref,\n )\n\n # Test max depth\n max_depth_result = store.list_namespaces(max_depth=3)\n assert all(len(ns) <= 3 for ns in max_depth_result)\n\n max_depth_result = store.list_namespaces(\n max_depth=4, prefix=(test_pref, "*", "documents")\n )\n assert len(set(res for res in max_depth_result)) == len(max_depth_result) == 5\n\n # Test pagination\n limit_result = store.list_namespaces(prefix=(test_pref,), limit=3)\n assert len(limit_result) == 3\n\n offset_result = store.list_namespaces(prefix=(test_pref,), offset=3)\n assert len(offset_result) == len(test_namespaces) - 3\n\n empty_prefix_result = store.list_namespaces(prefix=(test_pref,))\n assert len(empty_prefix_result) == len(test_namespaces)\n assert set(empty_prefix_result) == set(test_namespaces)\n\n # Clean up\n for namespace in test_namespaces:\n store.delete(namespace, "dummy")',792 'def test_doubly_nested_graph_state(\n sync_checkpointer: BaseCheckpointSaver,\n) -> None:\n class State(TypedDict):\n my_key: str\n\n class ChildState(TypedDict):\n my_key: str\n\n class GrandChildState(TypedDict):\n my_key: str\n\n def grandchild_1(state: ChildState):\n return {"my_key": state["my_key"] + " here"}\n\n def grandchild_2(state: ChildState):\n return {\n "my_key": state["my_key"] + " and there",\n }\n\n grandchild = StateGraph(GrandChildState)\n grandchild.add_node("grandchild_1", grandchild_1)\n grandchild.add_node("grandchild_2", grandchild_2)\n grandchild.add_edge("grandchild_1", "grandchild_2")\n grandchild.set_entry_point("grandchild_1")\n grandchild.set_finish_point("grandchild_2")\n\n child = StateGraph(ChildState)\n child.add_node(\n "child_1",\n grandchild.compile(interrupt_before=["grandchild_2"]),\n )\n child.set_entry_point("child_1")\n child.set_finish_point("child_1")\n\n def parent_1(state: State):\n return {"my_key": "hi " + state["my_key"]}\n\n def parent_2(state: State):\n return {"my_key": state["my_key"] + " and back again"}\n\n graph = StateGraph(State)\n graph.add_node("parent_1", parent_1)\n graph.add_node("child", child.compile())\n graph.add_node("parent_2", parent_2)\n graph.set_entry_point("parent_1")\n graph.add_edge("parent_1", "child")\n graph.add_edge("child", "parent_2")\n graph.set_finish_point("parent_2")\n\n app = graph.compile(checkpointer=sync_checkpointer)\n\n # test invoke w/ nested interrupt\n config = {"configurable": {"thread_id": "1"}}\n assert [\n c\n for c in app.stream(\n {"my_key": "my value"}, config, subgraphs=True, durability="exit"\n )\n ] == [\n ((), {"parent_1": {"my_key": "hi my value"}}),\n (\n (AnyStr("child:"), AnyStr("child_1:")),\n {"grandchild_1": {"my_key": "hi my value here"}},\n ),\n ((), {"__interrupt__": ()}),\n ]\n # get state without subgraphs\n outer_state = app.get_state(config)\n assert outer_state == StateSnapshot(\n values={"my_key": "hi my value"},\n tasks=(\n PregelTask(\n AnyStr(),\n "child",\n (PULL, "child"),\n state={\n "configurable": {\n "thread_id": "1",\n "checkpoint_ns": AnyStr("child"),\n }\n },\n ),\n ),\n next=("child",),\n config={\n "configurable": {\n "thread_id": "1",\n "checkpoint_ns": "",\n "checkpoint_id": AnyStr(),\n }\n },\n metadata={\n "parents": {},\n "source": "loop",\n "step": 1,\n },\n created_at=AnyStr(),\n parent_config=None,\n interrupts=(),\n )\n child_state = app.get_state(outer_state.tasks[0].state)\n assert child_state == StateSnapshot(\n values={"my_key": "hi my value"},\n tasks=(\n PregelTask(\n AnyStr(),\n "child_1",\n (PULL, "child_1"),\n state={\n "configurable": {\n "thread_id": "1",\n "checkpoint_ns": AnyStr(),\n }\n },\n ),\n ),\n next=("child_1",),\n config={\n "configurable": {\n "thread_id": "1",\n "checkpoint_ns": AnyStr("child:"),\n "checkpoint_id": AnyStr(),\n "checkpoint_map": AnyDict(\n {\n "": AnyStr(),\n AnyStr("child:"): AnyStr(),\n }\n ),\n }\n },\n metadata={\n "parents": {"": AnyStr()},\n "source": "loop",\n "step": 0,\n },\n created_at=AnyStr(),\n parent_config=None,\n interrupts=(),\n )\n grandchild_state = app.get_state(child_state.tasks[0].state)\n assert grandchild_state == StateSnapshot(\n values={"my_key": "hi my value here"},\n tasks=(\n PregelTask(\n AnyStr(),\n "grandchild_2",\n (PULL, "grandchild_2"),\n ),\n ),\n next=("grandchild_2",),\n config={\n "configurable": {\n "thread_id": "1",\n "checkpoint_ns": AnyStr(),\n "checkpoint_id": AnyStr(),\n "checkpoint_map": AnyDict(\n {\n "": AnyStr(),\n AnyStr("child:"): AnyStr(),\n AnyStr(re.compile(r"child:.+|child1:")): AnyStr(),\n }\n ),\n }\n },\n metadata={\n "parents": AnyDict(\n {\n "": AnyStr(),\n AnyStr("child:"): AnyStr(),\n }\n ),\n "source": "loop",\n "step": 1,\n },\n created_at=AnyStr(),\n parent_config=None,\n interrupts=(),\n )\n # get state with subgraphs\n assert app.get_state(config, subgraphs=True) == StateSnapshot(\n values={"my_key": "hi my value"},\n tasks=(\n PregelTask(\n AnyStr(),\n "child",\n (PULL, "child"),\n state=StateSnapshot(\n values={"my_key": "hi my value"},\n tasks=(\n PregelTask(\n AnyStr(),\n "child_1",\n (PULL, "child_1"),\n state=StateSnapshot(\n values={"my_key": "hi my value here"},\n tasks=(\n PregelTask(\n AnyStr(),\n "grandchild_2",\n (PULL, "grandchild_2"),\n ),\n ),\n next=("grandchild_2",),\n config={\n "configurable": {\n "thread_id": "1",\n "checkpoint_ns": AnyStr(),\n "checkpoint_id": AnyStr(),\n "checkpoint_map": AnyDict(\n {\n "": AnyStr(),\n AnyStr("child:"): AnyStr(),\n AnyStr(\n re.compile(r"child:.+|child1:")\n ): AnyStr(),\n }\n ),\n }\n },\n metadata={\n "parents": AnyDict(\n {\n "": AnyStr(),\n AnyStr("child:"): AnyStr(),\n }\n ),\n "source": "loop",\n "step": 1,\n },\n created_at=AnyStr(),\n parent_config=None,\n interrupts=(),\n ),\n ),\n ),\n next=("child_1",),\n config={\n "configurable": {\n "thread_id": "1",\n "checkpoint_ns": AnyStr("child:"),\n "checkpoint_id": AnyStr(),\n "checkpoint_map": AnyDict(\n {"": AnyStr(), AnyStr("child:"): AnyStr()}\n ),\n }\n },\n metadata={\n "parents": {"": AnyStr()},\n "source": "loop",\n "step": 0,\n },\n created_at=AnyStr(),\n parent_config=None,\n interrupts=(),\n ),\n ),\n ),\n next=("child",),\n config={\n "configurable": {\n "thread_id": "1",\n "checkpoint_ns": "",\n "checkpoint_id": AnyStr(),\n }\n },\n metadata={\n "parents": {},\n "source": "loop",\n "step": 1,\n },\n created_at=AnyStr(),\n parent_config=None,\n interrupts=(),\n )\n # # resume\n assert [c for c in app.stream(None, config, subgraphs=True, durability="exit")] == [\n (\n (AnyStr("child:"), AnyStr("child_1:")),\n {"grandchild_2": {"my_key": "hi my value here and there"}},\n ),\n ((AnyStr("child:"),), {"child_1": {"my_key": "hi my value here and there"}}),\n ((), {"child": {"my_key": "hi my value here and there"}}),\n ((), {"parent_2": {"my_key": "hi my value here and there and back again"}}),\n ]\n # get state with and without subgraphs\n assert (\n app.get_state(config)\n == app.get_state(config, subgraphs=True)\n == StateSnapshot(\n values={"my_key": "hi my value here and there and back again"},\n tasks=(),\n next=(),\n config={\n "configurable": {\n "thread_id": "1",\n "checkpoint_ns": "",\n "checkpoint_id": AnyStr(),\n }\n },\n metadata={\n "parents": {},\n "source": "loop",\n "step": 3,\n },\n created_at=AnyStr(),\n parent_config=(\n {\n "configurable": {\n "thread_id": "1",\n "checkpoint_ns": "",\n "checkpoint_id": AnyStr(),\n }\n }\n ),\n interrupts=(),\n )\n )\n\n # get outer graph history\n outer_history = list(app.get_state_history(config))\n assert outer_history == [\n StateSnapshot(\n values={"my_key": "hi my value here and there and back again"},\n tasks=(),\n next=(),\n config={\n "configurable": {\n "thread_id": "1",\n "checkpoint_ns": "",\n "checkpoint_id": AnyStr(),\n }\n },\n metadata={\n "parents": {},\n "source": "loop",\n "step": 3,\n },\n created_at=AnyStr(),\n parent_config={\n "configurable": {\n "thread_id": "1",\n "checkpoint_ns": "",\n "checkpoint_id": AnyStr(),\n }\n },\n interrupts=(),\n ),\n StateSnapshot(\n values={"my_key": "hi my value"},\n tasks=(\n PregelTask(\n AnyStr(),\n "child",\n (PULL, "child"),\n state={\n "configurable": {\n "thread_id": "1",\n "checkpoint_ns": AnyStr("child"),\n }\n },\n result=None,\n ),\n ),\n next=("child",),\n config={\n "configurable": {\n "thread_id": "1",\n "checkpoint_ns": "",\n "checkpoint_id": AnyStr(),\n }\n },\n metadata={\n "parents": {},\n "source": "loop",\n "step": 1,\n },\n created_at=AnyStr(),\n parent_config=None,\n interrupts=(),\n ),\n ]\n # get child graph history\n child_history = list(app.get_state_history(outer_history[1].tasks[0].state))\n assert child_history == [\n StateSnapshot(\n values={"my_key": "hi my value"},\n next=("child_1",),\n config={\n "configurable": {\n "thread_id": "1",\n "checkpoint_ns": AnyStr("child:"),\n "checkpoint_id": AnyStr(),\n "checkpoint_map": AnyDict(\n {"": AnyStr(), AnyStr("child:"): AnyStr()}\n ),\n }\n },\n metadata={\n "source": "loop",\n "step": 0,\n "parents": {"": AnyStr()},\n },\n created_at=AnyStr(),\n parent_config=None,\n tasks=(\n PregelTask(\n id=AnyStr(),\n name="child_1",\n path=(PULL, "child_1"),\n state={\n "configurable": {\n "thread_id": "1",\n "checkpoint_ns": AnyStr("child:"),\n }\n },\n result=None,\n ),\n ),\n interrupts=(),\n ),\n ]\n # get grandchild graph history\n grandchild_history = list(app.get_state_history(child_history[0].tasks[0].state))\n assert grandchild_history == [\n StateSnapshot(\n values={"my_key": "hi my value here"},\n next=("grandchild_2",),\n config={\n "configurable": {\n "thread_id": "1",\n "checkpoint_ns": AnyStr(),\n "checkpoint_id": AnyStr(),\n "checkpoint_map": AnyDict(\n {\n "": AnyStr(),\n AnyStr("child:"): AnyStr(),\n AnyStr(re.compile(r"child:.+|child1:")): AnyStr(),\n }\n ),\n }\n },\n metadata={\n "source": "loop",\n "step": 1,\n "parents": AnyDict(\n {\n "": AnyStr(),\n AnyStr("child:"): AnyStr(),\n }\n ),\n },\n created_at=AnyStr(),\n parent_config=None,\n tasks=(\n PregelTask(\n id=AnyStr(),\n name="grandchild_2",\n path=(PULL, "grandchild_2"),\n result=None,\n ),\n ),\n interrupts=(),\n ),\n ]',793]794embeddings = model.encode(sentences)795print(embeddings.shape)796# [3, 768]797 798# Get the similarity scores for the embeddings799similarities = model.similarity(embeddings, embeddings)800print(similarities)801# tensor([[1.0000, 0.7789, 0.3589],802# [0.7789, 1.0000, 0.4748],803# [0.3589, 0.4748, 1.0000]])804```805 806<!--807### Direct Usage (Transformers)808 809<details><summary>Click to see the direct usage in Transformers</summary>810 811</details>812-->813 814<!--815### Downstream Usage (Sentence Transformers)816 817You can finetune this model on your own dataset.818 819<details><summary>Click to expand</summary>820 821</details>822-->823 824<!--825### Out-of-Scope Use826 827*List how the model may foreseeably be misused and address what users ought not to do with the model.*828-->829 830## Evaluation831 832### Metrics833 834#### Information Retrieval835 836* Dataset: `dim_768`837* Evaluated with [<code>InformationRetrievalEvaluator</code>](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.InformationRetrievalEvaluator) with these parameters:838 ```json839 {840 "truncate_dim": 768841 }842 ```843 844| Metric | Value |845|:--------------------|:-----------|846| cosine_accuracy@1 | 0.9 |847| cosine_accuracy@3 | 0.9 |848| cosine_accuracy@5 | 1.0 |849| cosine_accuracy@10 | 1.0 |850| cosine_precision@1 | 0.9 |851| cosine_precision@3 | 0.3 |852| cosine_precision@5 | 0.2 |853| cosine_precision@10 | 0.1 |854| cosine_recall@1 | 0.9 |855| cosine_recall@3 | 0.9 |856| cosine_recall@5 | 1.0 |857| cosine_recall@10 | 1.0 |858| **cosine_ndcg@10** | **0.9409** |859| cosine_mrr@10 | 0.9225 |860| cosine_map@100 | 0.9225 |861 862#### Information Retrieval863 864* Dataset: `dim_512`865* Evaluated with [<code>InformationRetrievalEvaluator</code>](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.InformationRetrievalEvaluator) with these parameters:866 ```json867 {868 "truncate_dim": 512869 }870 ```871 872| Metric | Value |873|:--------------------|:-----------|874| cosine_accuracy@1 | 0.9 |875| cosine_accuracy@3 | 0.9 |876| cosine_accuracy@5 | 1.0 |877| cosine_accuracy@10 | 1.0 |878| cosine_precision@1 | 0.9 |879| cosine_precision@3 | 0.3 |880| cosine_precision@5 | 0.2 |881| cosine_precision@10 | 0.1 |882| cosine_recall@1 | 0.9 |883| cosine_recall@3 | 0.9 |884| cosine_recall@5 | 1.0 |885| cosine_recall@10 | 1.0 |886| **cosine_ndcg@10** | **0.9409** |887| cosine_mrr@10 | 0.9225 |888| cosine_map@100 | 0.9225 |889 890#### Information Retrieval891 892* Dataset: `dim_256`893* Evaluated with [<code>InformationRetrievalEvaluator</code>](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.InformationRetrievalEvaluator) with these parameters:894 ```json895 {896 "truncate_dim": 256897 }898 ```899 900| Metric | Value |901|:--------------------|:-----------|902| cosine_accuracy@1 | 0.9 |903| cosine_accuracy@3 | 0.9 |904| cosine_accuracy@5 | 1.0 |905| cosine_accuracy@10 | 1.0 |906| cosine_precision@1 | 0.9 |907| cosine_precision@3 | 0.3 |908| cosine_precision@5 | 0.2 |909| cosine_precision@10 | 0.1 |910| cosine_recall@1 | 0.9 |911| cosine_recall@3 | 0.9 |912| cosine_recall@5 | 1.0 |913| cosine_recall@10 | 1.0 |914| **cosine_ndcg@10** | **0.9409** |915| cosine_mrr@10 | 0.9225 |916| cosine_map@100 | 0.9225 |917 918#### Information Retrieval919 920* Dataset: `dim_128`921* Evaluated with [<code>InformationRetrievalEvaluator</code>](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.InformationRetrievalEvaluator) with these parameters:922 ```json923 {924 "truncate_dim": 128925 }926 ```927 928| Metric | Value |929|:--------------------|:-----------|930| cosine_accuracy@1 | 0.85 |931| cosine_accuracy@3 | 0.9 |932| cosine_accuracy@5 | 0.95 |933| cosine_accuracy@10 | 0.95 |934| cosine_precision@1 | 0.85 |935| cosine_precision@3 | 0.3 |936| cosine_precision@5 | 0.19 |937| cosine_precision@10 | 0.095 |938| cosine_recall@1 | 0.85 |939| cosine_recall@3 | 0.9 |940| cosine_recall@5 | 0.95 |941| cosine_recall@10 | 0.95 |942| **cosine_ndcg@10** | **0.8943** |943| cosine_mrr@10 | 0.8767 |944| cosine_map@100 | 0.88 |945 946#### Information Retrieval947 948* Dataset: `dim_64`949* Evaluated with [<code>InformationRetrievalEvaluator</code>](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.InformationRetrievalEvaluator) with these parameters:950 ```json951 {952 "truncate_dim": 64953 }954 ```955 956| Metric | Value |957|:--------------------|:-----------|958| cosine_accuracy@1 | 0.85 |959| cosine_accuracy@3 | 0.9 |960| cosine_accuracy@5 | 0.9 |961| cosine_accuracy@10 | 1.0 |962| cosine_precision@1 | 0.85 |963| cosine_precision@3 | 0.3 |964| cosine_precision@5 | 0.18 |965| cosine_precision@10 | 0.1 |966| cosine_recall@1 | 0.85 |967| cosine_recall@3 | 0.9 |968| cosine_recall@5 | 0.9 |969| cosine_recall@10 | 1.0 |970| **cosine_ndcg@10** | **0.9074** |971| cosine_mrr@10 | 0.8801 |972| cosine_map@100 | 0.8801 |973 974<!--975## Bias, Risks and Limitations976 977*What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*978-->979 980<!--981### Recommendations982 983*What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*984-->985 986## Training Details987 988### Training Dataset989 990#### Unnamed Dataset991 992* Size: 180 training samples993* Columns: <code>anchor</code> and <code>positive</code>994* Approximate statistics based on the first 180 samples:995 | | anchor | positive |996 |:--------|:-----------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------|997 | type | string | string |998 | details | <ul><li>min: 6 tokens</li><li>mean: 12.34 tokens</li><li>max: 117 tokens</li></ul> | <ul><li>min: 14 tokens</li><li>mean: 273.18 tokens</li><li>max: 512 tokens</li></ul> |999* Samples:1000 | anchor | positive |1001 |:-----------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|1002 | <code>How to implement State?</code> | <code>class State(TypedDict):<br> messages: Annotated[list[str], operator.add]</code> |1003 | <code>Best practices for test_sql_injection_vulnerability</code> | <code>def test_sql_injection_vulnerability(store: SqliteStore) -> None:<br> """Test that SQL injection via malicious filter keys is prevented."""<br> # Add public and private documents<br> store.put(("docs",), "public", {"access": "public", "data": "public info"})<br> store.put(<br> ("docs",), "private", {"access": "private", "data": "secret", "password": "123"}<br> )<br><br> # Normal query - returns 1 public document<br> normal = store.search(("docs",), filter={"access": "public"})<br> assert len(normal) == 1<br> assert normal[0].value["access"] == "public"<br><br> # SQL injection attempt via malicious key should raise ValueError<br> malicious_key = "access') = 'public' OR '1'='1' OR json_extract(value, '$."<br><br> with pytest.raises(ValueError, match="Invalid filter key"):<br> store.search(("docs",), filter={malicious_key: "dummy"})</code> |1004 | <code>Example usage of put_writes</code> | <code>def put_writes(<br> self,<br> config: RunnableConfig,<br> writes: Sequence[tuple[str, Any]],<br> task_id: str,<br> task_path: str = "",<br> ) -> None:<br> """Store intermediate writes linked to a checkpoint.<br><br> This method saves intermediate writes associated with a checkpoint to the Postgres database.<br><br> Args:<br> config: Configuration of the related checkpoint.<br> writes: List of writes to store.<br> task_id: Identifier for the task creating the writes.<br> """<br> query = (<br> self.UPSERT_CHECKPOINT_WRITES_SQL<br> if all(w[0] in WRITES_IDX_MAP for w in writes)<br> else self.INSERT_CHECKPOINT_WRITES_SQL<br> )<br> with self._cursor(pipeline=True) as cur:<br> cur.executemany(<br> query,<br> self._dump_writes(<br> config["configurable"]["thread_id"],<br> config["configurable"]["checkpoint_ns"],<br> config["c...</code> |1005* Loss: [<code>MatryoshkaLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#matryoshkaloss) with these parameters:1006 ```json1007 {1008 "loss": "MultipleNegativesRankingLoss",1009 "matryoshka_dims": [1010 768,1011 512,1012 256,1013 128,1014 641015 ],1016 "matryoshka_weights": [1017 1,1018 1,1019 1,1020 1,1021 11022 ],1023 "n_dims_per_step": -11024 }1025 ```1026 1027### Training Hyperparameters1028#### Non-Default Hyperparameters1029 1030- `eval_strategy`: epoch1031- `per_device_train_batch_size`: 41032- `per_device_eval_batch_size`: 41033- `gradient_accumulation_steps`: 161034- `learning_rate`: 2e-051035- `num_train_epochs`: 21036- `lr_scheduler_type`: cosine1037- `warmup_ratio`: 0.11038- `fp16`: True1039- `load_best_model_at_end`: True1040- `optim`: adamw_torch1041- `batch_sampler`: no_duplicates1042 1043#### All Hyperparameters1044<details><summary>Click to expand</summary>1045 1046- `overwrite_output_dir`: False1047- `do_predict`: False1048- `eval_strategy`: epoch1049- `prediction_loss_only`: True1050- `per_device_train_batch_size`: 41051- `per_device_eval_batch_size`: 41052- `per_gpu_train_batch_size`: None1053- `per_gpu_eval_batch_size`: None1054- `gradient_accumulation_steps`: 161055- `eval_accumulation_steps`: None1056- `torch_empty_cache_steps`: None1057- `learning_rate`: 2e-051058- `weight_decay`: 0.01059- `adam_beta1`: 0.91060- `adam_beta2`: 0.9991061- `adam_epsilon`: 1e-081062- `max_grad_norm`: 1.01063- `num_train_epochs`: 21064- `max_steps`: -11065- `lr_scheduler_type`: cosine1066- `lr_scheduler_kwargs`: {}1067- `warmup_ratio`: 0.11068- `warmup_steps`: 01069- `log_level`: passive1070- `log_level_replica`: warning1071- `log_on_each_node`: True1072- `logging_nan_inf_filter`: True1073- `save_safetensors`: True1074- `save_on_each_node`: False1075- `save_only_model`: False1076- `restore_callback_states_from_checkpoint`: False1077- `no_cuda`: False1078- `use_cpu`: False1079- `use_mps_device`: False1080- `seed`: 421081- `data_seed`: None1082- `jit_mode_eval`: False1083- `bf16`: False1084- `fp16`: True1085- `fp16_opt_level`: O11086- `half_precision_backend`: auto1087- `bf16_full_eval`: False1088- `fp16_full_eval`: False1089- `tf32`: None1090- `local_rank`: 01091- `ddp_backend`: None1092- `tpu_num_cores`: None1093- `tpu_metrics_debug`: False1094- `debug`: []1095- `dataloader_drop_last`: False1096- `dataloader_num_workers`: 01097- `dataloader_prefetch_factor`: None1098- `past_index`: -11099- `disable_tqdm`: False1100- `remove_unused_columns`: True1101- `label_names`: None1102- `load_best_model_at_end`: True1103- `ignore_data_skip`: False1104- `fsdp`: []1105- `fsdp_min_num_params`: 01106- `fsdp_config`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}1107- `fsdp_transformer_layer_cls_to_wrap`: None1108- `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}1109- `parallelism_config`: None1110- `deepspeed`: None1111- `label_smoothing_factor`: 0.01112- `optim`: adamw_torch1113- `optim_args`: None1114- `adafactor`: False1115- `group_by_length`: False1116- `length_column_name`: length1117- `project`: huggingface1118- `trackio_space_id`: trackio1119- `ddp_find_unused_parameters`: None1120- `ddp_bucket_cap_mb`: None1121- `ddp_broadcast_buffers`: False1122- `dataloader_pin_memory`: True1123- `dataloader_persistent_workers`: False1124- `skip_memory_metrics`: True1125- `use_legacy_prediction_loop`: False1126- `push_to_hub`: False1127- `resume_from_checkpoint`: None1128- `hub_model_id`: None1129- `hub_strategy`: every_save1130- `hub_private_repo`: None1131- `hub_always_push`: False1132- `hub_revision`: None1133- `gradient_checkpointing`: False1134- `gradient_checkpointing_kwargs`: None1135- `include_inputs_for_metrics`: False1136- `include_for_metrics`: []1137- `eval_do_concat_batches`: True1138- `fp16_backend`: auto1139- `push_to_hub_model_id`: None1140- `push_to_hub_organization`: None1141- `mp_parameters`: 1142- `auto_find_batch_size`: False1143- `full_determinism`: False1144- `torchdynamo`: None1145- `ray_scope`: last1146- `ddp_timeout`: 18001147- `torch_compile`: False1148- `torch_compile_backend`: None1149- `torch_compile_mode`: None1150- `include_tokens_per_second`: False1151- `include_num_input_tokens_seen`: no1152- `neftune_noise_alpha`: None1153- `optim_target_modules`: None1154- `batch_eval_metrics`: False1155- `eval_on_start`: False1156- `use_liger_kernel`: False1157- `liger_kernel_config`: None1158- `eval_use_gather_object`: False1159- `average_tokens_across_devices`: True1160- `prompts`: None1161- `batch_sampler`: no_duplicates1162- `multi_dataset_batch_sampler`: proportional1163- `router_mapping`: {}1164- `learning_rate_mapping`: {}1165 1166</details>1167 1168### Training Logs1169| Epoch | Step | dim_768_cosine_ndcg@10 | dim_512_cosine_ndcg@10 | dim_256_cosine_ndcg@10 | dim_128_cosine_ndcg@10 | dim_64_cosine_ndcg@10 |1170|:-------:|:-----:|:----------------------:|:----------------------:|:----------------------:|:----------------------:|:---------------------:|1171| 1.0 | 3 | 0.9409 | 0.9202 | 0.9431 | 0.8412 | 0.9059 |1172| **2.0** | **6** | **0.9409** | **0.9409** | **0.9409** | **0.8943** | **0.9074** |1173 1174* The bold row denotes the saved checkpoint.1175 1176### Framework Versions1177- Python: 3.14.01178- Sentence Transformers: 5.2.21179- Transformers: 4.57.31180- PyTorch: 2.9.11181- Accelerate: 1.12.01182- Datasets: 4.5.01183- Tokenizers: 0.22.21184 1185## Citation1186 1187### BibTeX1188 1189#### Sentence Transformers1190```bibtex1191@inproceedings{reimers-2019-sentence-bert,1192 title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",1193 author = "Reimers, Nils and Gurevych, Iryna",1194 booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",1195 month = "11",1196 year = "2019",1197 publisher = "Association for Computational Linguistics",1198 url = "https://arxiv.org/abs/1908.10084",1199}1200```