semvec/pypi-packages huggingface dataset:
pydantic-schema-sync 0.1.5
Synchronise Pydantic model schemas with JSONSchema files
License: MIT
Requires Python: >=3.10

# pydantic-schema-sync

Synchronise Pydantic model schemas with JSONSchema files.

## Usage

### CLI

```
usage: model-schema-sync [-h] [--model MODEL] [--schema_path SCHEMA_PATH]
                         [--mjs_kwargs MJS_KWARGS]

Config for syncing Pydantic model schemas to disk.

options:
  -h, --help            show this help message and exit
  --model MODEL         Dotted import path to the Pydantic model
  --schema_path SCHEMA_PATH
                        File path to save the schema at
  --mjs_kwargs MJS_KWARGS
                        Kwargs to pass `.model_json_schema()`
```

To serialise the schema of the model named `SyncCLI` (in the package `pydantic_schema_sync`'s `cli` module)
to the file `schema.json`, passing the `by_alias=False` param to `.model_json_schema()`:

```sh
model-schema-sync \
  --model pydantic_schema_sync.cli.SyncCLI \
  --schema_path schema.json \
  --mjs_kwargs '{"by_alias": false}'
```

### Python

From a model class:

```py
from pydantic_schema_sync import sync_schema

# Using field alias (default)
sync_schema(model=Foo, schema_path="schema.json")

# Unaliased field
sync_schema(model=Foo, schema_path="schema.json", mjs_kwargs={"by_alias": False})
```

From a path to a model class:

```py
from pydantic_schema_sync import sync_schema_from_path

# This path must be in an installed package
path_to_model_cls = "pydantic_schema_sync.cli.SyncCLI"
sync_schema_from_path(model=path_to_model_cls, schema_path="schema.json")
```
gigachain-unstructured 0.1.2
An integration package connecting Unstructured and LangChain
License: MIT
Requires Python: <4.0,>=3.9

# langchain-unstructured

This package contains the LangChain integration with Unstructured

## Installation

```bash
pip install -U langchain-unstructured
```

And you should configure credentials by setting the following environment variables:

```bash
export UNSTRUCTURED_API_KEY="your-api-key"
```

## Loaders

Partition and load files using either the `unstructured-client` sdk and the
Unstructured API or locally using the `unstructured` library.

API:
To partition via the Unstructured API `pip install unstructured-client` and set
`partition_via_api=True` and define `api_key`. If you are running the unstructured API
locally, you can change the API rule by defining `url` when you initialize the
loader. The hosted Unstructured API requires an API key. See the links below to
learn more about our API offerings and get an API key.

Local:
By default the file loader uses the Unstructured `partition` function and will
automatically detect the file type.

In addition to document specific partition parameters, Unstructured has a rich set
of "chunking" parameters for post-processing elements into more useful text segments
for uses cases such as Retrieval Augmented Generation (RAG). You can pass additional
Unstructured kwargs to the loader to configure different unstructured settings.

Setup:
```bash
    pip install -U langchain-unstructured
    pip install -U unstructured-client
    export UNSTRUCTURED_API_KEY="your-api-key"
```

Instantiate:
```python
from langchain_unstructured import UnstructuredLoader

loader = UnstructuredLoader(
    file_path = ["example.pdf", "fake.pdf"],
    api_key=UNSTRUCTURED_API_KEY,
    partition_via_api=True,
    chunking_strategy="by_title",
    strategy="fast",
)
```

Load:
```python
docs = loader.load()

print(docs[0].page_content[:100])
print(docs[0].metadata)
```

References
----------
https://docs.unstructured.io/api-reference/api-services/sdk
https://docs.unstructured.io/api-reference/api-services/overview
https://docs.unstructured.io/open-source/core-functionality/partitioning
https://docs.unstructured.io/open-source/core-functionality/chunking
gigachain-openai 0.1.22
An integration package connecting OpenAI and LangChain
License: MIT
Requires Python: <4.0,>=3.8.1

# langchain-openai

This package contains the LangChain integrations for OpenAI through their `openai` SDK.

## Installation and Setup

- Install the LangChain partner package
```bash
pip install gigachain-openai
```
- Get an OpenAI api key and set it as an environment variable (`OPENAI_API_KEY`)


## LLM

See a [usage example](http://python.langchain.com/docs/integrations/llms/openai).

```python
from langchain_openai import OpenAI
```

If you are using a model hosted on `Azure`, you should use different wrapper for that:
```python
from langchain_openai import AzureOpenAI
```
For a more detailed walkthrough of the `Azure` wrapper, see [here](http://python.langchain.com/docs/integrations/llms/azure_openai)


## Chat model

See a [usage example](http://python.langchain.com/docs/integrations/chat/openai).

```python
from langchain_openai import ChatOpenAI
```

If you are using a model hosted on `Azure`, you should use different wrapper for that:
```python
from langchain_openai import AzureChatOpenAI
```
For a more detailed walkthrough of the `Azure` wrapper, see [here](http://python.langchain.com/docs/integrations/chat/azure_chat_openai)


## Text Embedding Model

See a [usage example](http://python.langchain.com/docs/integrations/text_embedding/openai)

```python
from langchain_openai import OpenAIEmbeddings
```

If you are using a model hosted on `Azure`, you should use different wrapper for that:
```python
from langchain_openai import AzureOpenAIEmbeddings
```
For a more detailed walkthrough of the `Azure` wrapper, see [here](https://python.langchain.com/docs/integrations/text_embedding/azureopenai)
gigachain-chroma 0.1.3
An integration package connecting Chroma and LangChain
License: MIT
Requires Python: <4,>=3.8.1

# gigachain-chroma

This package contains the LangChain integration with Chroma.

## Installation

```bash
pip install -U gigachain-chroma
```

## Usage

The `Chroma` class exposes the connection to the Chroma vector store.

```python
from langchain_chroma import Chroma

embeddings = ... # use a LangChain Embeddings class

vectorstore = Chroma(embeddings=embeddings)
```
gigachain-anthropic 0.1.23
An integration package connecting AnthropicMessages and LangChain
License: MIT
Requires Python: <4.0,>=3.8.1

# langchain-anthropic

This package contains the LangChain integration for Anthropic's generative models.

## Installation

`pip install -U langchain-anthropic`

## Chat Models

Anthropic recommends using their chat models over text completions.

You can see their recommended models [here](https://docs.anthropic.com/claude/docs/models-overview#model-recommendations).

To use, you should have an Anthropic API key configured. Initialize the model as:

```
from langchain_anthropic import ChatAnthropic
from langchain_core.messages import AIMessage, HumanMessage

model = ChatAnthropic(model="claude-3-opus-20240229", temperature=0, max_tokens=1024)
```

### Define the input message

`message = HumanMessage(content="What is the capital of France?")`

### Generate a response using the model

`response = model.invoke([message])`

For a more detailed walkthrough see [here](https://python.langchain.com/docs/integrations/chat/anthropic).

## LLMs (Legacy)

You can use the Claude 2 models for text completions.

```python
from langchain_anthropic import AnthropicLLM

model = AnthropicLLM(model="claude-2.1", temperature=0, max_tokens=1024)
response = model.invoke("The best restaurant in San Francisco is: ")
```