langtree.models.openai

Submodules

Package Contents

Classes

Operator

A class to represent and process custom call and parse operations.

OpenAIChatCompletion

A class to represent and process custom call and parse operations.

OpenAICompletion

A class to represent and process custom call and parse operations.

OpenAIEmbedding

A class to represent and process custom call and parse operations.

Functions

get_embedding_content(output)

Process the output to return a list of embeddings.

get_chat_content(output)

make_open_ai_embedding_call(func)

class langtree.models.openai.Operator(call=default_call, parse=default_parse)[source]

Bases: object

A class to represent and process custom call and parse operations.

__call__(*args, **kwargs)[source]

Call the Operator’s call function and parse its result.

Parameters:
  • *args – Variable length argument list.

  • **kwargs – Arbitrary keyword arguments.

Returns:

The parsed result of the call function.

freeze_call(**kwargs)[source]

Freeze specific arguments for the Operator’s call function.

Parameters:

**kwargs – Keyword arguments to freeze.

freeze_parse(**kwargs)[source]

Freeze specific arguments for the Operator’s parse function.

Parameters:

**kwargs – Keyword arguments to freeze.

langtree.models.openai.get_embedding_content(output)[source]

Process the output to return a list of embeddings.

Each embedding is a list of float values.

Parameters:

output (list of lists) – The output containing potential embeddings.

Returns:

Processed embeddings as lists of float values.

Return type:

list of lists

langtree.models.openai.get_chat_content(output)[source]
class langtree.models.openai.OpenAIChatCompletion(call=None, parse=None, **kwargs)[source]

Bases: langtree.core.Operator

A class to represent and process custom call and parse operations.

class langtree.models.openai.OpenAICompletion(call=None, parse=None, **kwargs)[source]

Bases: langtree.core.Operator

A class to represent and process custom call and parse operations.

langtree.models.openai.make_open_ai_embedding_call(func)[source]
class langtree.models.openai.OpenAIEmbedding(call=None, **kwargs)[source]

Bases: langtree.core.Operator

A class to represent and process custom call and parse operations.