{
  "name": "forge.generate",
  "language": "python",
  "version": "0.1.0",
  "description": "Python generate package; imports are explicit from this package.",
  "manifest": "forge-py/pyproject.toml",
  "manifestSha256": "7f96957378b21995bf2e583af2afd1b9e6fb3b0089ff3559d62c7e012a034696",
  "status": "source-reference",
  "registryPublicationVerified": false,
  "route": "/libraries/python/generate",
  "features": {},
  "files": [
    {
      "path": "forge-py/src/forge/generate/__init__.py",
      "sha256": "9489a759d4ee02c8947720df5c97f747a6035433c73c58f46c1d9c9fbe79a1ff",
      "artifactSha256": "aeae9c8c009269d44766ae3fb95ec5de63b8fb2cb7f2a2632e355f5b06cc0249",
      "url": "/reference/source/forge-py/src/forge/generate/__init__.py.txt",
      "declarations": []
    },
    {
      "path": "forge-py/src/forge/generate/object.py",
      "sha256": "796b0ca8d1acef0f8095093bffb6558812920f1361a23c73f0216719944ff80f",
      "artifactSha256": "b8e269ff29dd3a6c4b28e94770c4b0333a24a7ee308e10c1aedb3c2b520177bc",
      "url": "/reference/source/forge-py/src/forge/generate/object.py.txt",
      "declarations": [
        {
          "name": "generate_object",
          "line": 31,
          "signature": "async def generate_object(model: LanguageModel, messages: list[ModelMessage], schema: JsonSchema, *, options: GenerateOptions | None=None, system: str | None=None) -> tuple[Any, GenerateResult]",
          "documentation": "Generate a structured object response from a language model.\n\nThe model is instructed to produce JSON conforming to the given schema.\nThe response is parsed and validated before returning.\n\nArgs:\n    model: The language model to use.\n    messages: The conversation history.\n    schema: The JSON Schema the output must conform to.\n    options: Optional generation options.\n    system: Optional system prompt.\n\nReturns:\n    A tuple of (parsed_object, GenerateResult).\n\nRaises:\n    ForgeUnsupportedOperationError: If the model does not support structured output.\n    ForgeSchemaValidationError: If the response does not conform to the schema.\n    ForgeJsonError: If the response is not valid JSON."
        },
        {
          "name": "stream_object",
          "line": 89,
          "signature": "async def stream_object(model: LanguageModel, messages: list[ModelMessage], schema: JsonSchema, *, options: GenerateOptions | None=None, system: str | None=None) -> AsyncGenerator[str, None]",
          "documentation": "Stream a structured object response, yielding partial JSON strings.\n\nEach yield contains a portion of the JSON output. The final concatenation\nof all yields produces the complete JSON object.\n\nArgs:\n    model: The language model to use.\n    messages: The conversation history.\n    schema: The JSON Schema the output must conform to.\n    options: Optional generation options.\n    system: Optional system prompt.\n\nYields:\n    Partial JSON string fragments.\n\nRaises:\n    ForgeUnsupportedOperationError: If the model does not support\n        streaming or structured output."
        }
      ]
    },
    {
      "path": "forge-py/src/forge/generate/stream.py",
      "sha256": "d1d007f87379f843f2f34a427dee1e7939bcd95ed9d5f6285218c427b4abb002",
      "artifactSha256": "86bc6c314c519176fa370f8a6a7889dd7144256e140aab906d40f8b7cb99ad50",
      "url": "/reference/source/forge-py/src/forge/generate/stream.py.txt",
      "declarations": [
        {
          "name": "stream_text",
          "line": 24,
          "signature": "async def stream_text(model: LanguageModel, messages: list[ModelMessage], *, tools: list[ToolDefinition] | None=None, options: GenerateOptions | None=None, system: str | None=None) -> AsyncGenerator[StreamChunk, None]",
          "documentation": "Stream a text response from a language model.\n\nThis function returns an async generator that yields StreamChunk instances\nas they arrive from the model.\n\nANVIL Spec section 6.1: Maps to the ``infer_stream()`` cognitive interface method.\n\nArgs:\n    model: The language model to use.\n    messages: The conversation history.\n    tools: Optional tool definitions available for this call.\n    options: Optional generation options.\n    system: Optional system prompt.\n\nYields:\n    StreamChunk instances (TextDelta, ToolCallDelta, or StreamDone).\n\nRaises:\n    ForgeUnsupportedOperationError: If the model does not support streaming.\n    ForgeError: If the provider call fails."
        }
      ]
    },
    {
      "path": "forge-py/src/forge/generate/text.py",
      "sha256": "6ef01753b4bd32e15f8dac949ceb73452ea6cf6f0bc811953f226abfd16c128d",
      "artifactSha256": "3ba17ee2c04ead13be55f77e0039198079588f05e068259eefc2c5e0f940739a",
      "url": "/reference/source/forge-py/src/forge/generate/text.py.txt",
      "declarations": [
        {
          "name": "generate_text",
          "line": 23,
          "signature": "async def generate_text(model: LanguageModel, messages: list[ModelMessage], *, tools: list[ToolDefinition] | None=None, options: GenerateOptions | None=None, system: str | None=None) -> GenerateResult",
          "documentation": "Generate a complete text response from a language model.\n\nThis is the primary text generation function. It sends messages to the\nmodel and waits for the complete response.\n\nANVIL Spec section 6.1: Maps to the ``infer()`` cognitive interface method.\n\nArgs:\n    model: The language model to use.\n    messages: The conversation history.\n    tools: Optional tool definitions available for this call.\n    options: Optional generation options (temperature, max_tokens, etc.).\n    system: Optional system prompt (prepended as a system message).\n\nReturns:\n    A GenerateResult containing the model's response.\n\nRaises:\n    ForgeUnsupportedOperationError: If the model does not support the\n        requested operation.\n    ForgeError: If the provider call fails.\n\nExample:\n    >>> # With a mock model:\n    >>> # result = await generate_text(model, [ModelMessage.text(Role.USER, \"Hi\")])"
        }
      ]
    }
  ]
}
