Home / File/ completions.py — anthropic-sdk-python Source File

completions.py — anthropic-sdk-python Source File

Architecture documentation for completions.py, a python file in the anthropic-sdk-python codebase. 17 imports, 1 dependents.

File python AnthropicClient SyncAPI 17 imports 1 dependents 6 classes

Entity Profile

Dependency Diagram

graph LR
  f5340606_93f4_b0e0_a723_bb2136763e51["completions.py"]
  711d3916_d5a7_c3e4_d380_e4745361142d["711d3916:d5a7:c3e4:d380:e4745361142d"]
  f5340606_93f4_b0e0_a723_bb2136763e51 --> 711d3916_d5a7_c3e4_d380_e4745361142d
  bbb75a75_73e0_c1d2_8fe4_5dfd52f08af9["types"]
  f5340606_93f4_b0e0_a723_bb2136763e51 --> bbb75a75_73e0_c1d2_8fe4_5dfd52f08af9
  44e25172_a38e_964d_ff57_c147e3ff3ded["_types"]
  f5340606_93f4_b0e0_a723_bb2136763e51 --> 44e25172_a38e_964d_ff57_c147e3ff3ded
  05bc2426_c4bc_3210_d02a_17f0f58e9392["_utils"]
  f5340606_93f4_b0e0_a723_bb2136763e51 --> 05bc2426_c4bc_3210_d02a_17f0f58e9392
  f1ff822f_349c_67ee_8cd9_573fb95c18a4["_compat"]
  f5340606_93f4_b0e0_a723_bb2136763e51 --> f1ff822f_349c_67ee_8cd9_573fb95c18a4
  833cd20e_92cf_69d7_2d6b_af3c0a15e606["_resource"]
  f5340606_93f4_b0e0_a723_bb2136763e51 --> 833cd20e_92cf_69d7_2d6b_af3c0a15e606
  45e6e669_bb0f_ca05_f8e3_7f4636fe70c4["_response"]
  f5340606_93f4_b0e0_a723_bb2136763e51 --> 45e6e669_bb0f_ca05_f8e3_7f4636fe70c4
  26e3dc62_0759_131b_4f7c_d678f8743788["_constants"]
  f5340606_93f4_b0e0_a723_bb2136763e51 --> 26e3dc62_0759_131b_4f7c_d678f8743788
  5c93f450_aa2f_4717_c07a_aeecca341b25["_streaming"]
  f5340606_93f4_b0e0_a723_bb2136763e51 --> 5c93f450_aa2f_4717_c07a_aeecca341b25
  a1b46bdc_f0c1_ce7a_0c91_5c0ac0a06444["_base_client"]
  f5340606_93f4_b0e0_a723_bb2136763e51 --> a1b46bdc_f0c1_ce7a_0c91_5c0ac0a06444
  cabb7fc3_5be8_a0db_b526_cd17d00f1f3c["types.completion"]
  f5340606_93f4_b0e0_a723_bb2136763e51 --> cabb7fc3_5be8_a0db_b526_cd17d00f1f3c
  0b431645_db2d_3582_aa0d_7567e09fc829["types.model_param"]
  f5340606_93f4_b0e0_a723_bb2136763e51 --> 0b431645_db2d_3582_aa0d_7567e09fc829
  35d00444_aea4_f3e1_8ca7_2212b3b22964["types.metadata_param"]
  f5340606_93f4_b0e0_a723_bb2136763e51 --> 35d00444_aea4_f3e1_8ca7_2212b3b22964
  00ed9528_03de_7d03_0ffb_672ff72a0ec6["types.anthropic_beta_param"]
  f5340606_93f4_b0e0_a723_bb2136763e51 --> 00ed9528_03de_7d03_0ffb_672ff72a0ec6
  style f5340606_93f4_b0e0_a723_bb2136763e51 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

from typing import List
from typing_extensions import Literal, overload

import httpx

from .. import _legacy_response
from ..types import completion_create_params
from .._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
from .._utils import is_given, required_args, maybe_transform, strip_not_given, async_maybe_transform
from .._compat import cached_property
from .._resource import SyncAPIResource, AsyncAPIResource
from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper
from .._constants import DEFAULT_TIMEOUT
from .._streaming import Stream, AsyncStream
from .._base_client import make_request_options
from ..types.completion import Completion
from ..types.model_param import ModelParam
from ..types.metadata_param import MetadataParam
from ..types.anthropic_beta_param import AnthropicBetaParam

__all__ = ["Completions", "AsyncCompletions"]


class Completions(SyncAPIResource):
    @cached_property
    def with_raw_response(self) -> CompletionsWithRawResponse:
        """
        This property can be used as a prefix for any HTTP method call to return
        the raw response object instead of the parsed content.

        For more information, see https://www.github.com/anthropics/anthropic-sdk-python#accessing-raw-response-data-eg-headers
        """
        return CompletionsWithRawResponse(self)

    @cached_property
    def with_streaming_response(self) -> CompletionsWithStreamingResponse:
        """
        An alternative to `.with_raw_response` that doesn't eagerly read the response body.

        For more information, see https://www.github.com/anthropics/anthropic-sdk-python#with_streaming_response
        """
        return CompletionsWithStreamingResponse(self)

    @overload
    def create(
        self,
        *,
        max_tokens_to_sample: int,
        model: ModelParam,
        prompt: str,
        metadata: MetadataParam | Omit = omit,
        stop_sequences: SequenceNotStr[str] | Omit = omit,
        stream: Literal[False] | Omit = omit,
        temperature: float | Omit = omit,
        top_k: int | Omit = omit,
        top_p: float | Omit = omit,
// ... (786 more lines)

Subdomains

Dependencies

  • 711d3916:d5a7:c3e4:d380:e4745361142d
  • _base_client
  • _compat
  • _constants
  • _resource
  • _response
  • _streaming
  • _types
  • _utils
  • httpx
  • types
  • types.anthropic_beta_param
  • types.completion
  • types.metadata_param
  • types.model_param
  • typing
  • typing_extensions

Frequently Asked Questions

What does completions.py do?
completions.py is a source file in the anthropic-sdk-python codebase, written in python. It belongs to the AnthropicClient domain, SyncAPI subdomain.
What does completions.py depend on?
completions.py imports 17 module(s): 711d3916:d5a7:c3e4:d380:e4745361142d, _base_client, _compat, _constants, _resource, _response, _streaming, _types, and 9 more.
What files import completions.py?
completions.py is imported by 1 file(s): __init__.py.
Where is completions.py in the architecture?
completions.py is located at src/anthropic/resources/completions.py (domain: AnthropicClient, subdomain: SyncAPI, directory: src/anthropic/resources).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free