Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create edgedb.ai package #489

Merged
merged 5 commits into from
May 1, 2024
Merged

Create edgedb.ai package #489

merged 5 commits into from
May 1, 2024

Conversation

fantix
Copy link
Member

@fantix fantix commented Apr 26, 2024

Blocking client:

import edgedb
import edgedb.ai

c = edgedb.create_client()
gpt4ai = edgedb.ai.create_AI(c, model="gpt-4-turbo-preview")
blog_ai = gpt4ai.with_context(query="select BlogPost")
print(blog_ai.query_rag("what's that?"))

# or use event-stream:
for data in blog_ai.stream_rag("what's that?"):
    print(data)

Async client:

import asyncio
import edgedb
import edgedb.ai

c = edgedb.create_async_client()

async def main():
    gpt4ai = await edgedb.ai.create_async_AI(c, model="gpt-4-turbo-preview")
    blog_ai = gpt4ai.with_context(query="select BlogPost")
    print(await blog_ai.query_rag("what's that?"))

    # or use event-stream:
    async for data in blog_ai.stream_rag("what's that?"):
        print(data)


asyncio.run(main())

edgedb/ai/__init__.py Outdated Show resolved Hide resolved

def _init_client(self, **kwargs):
self.client = httpx.Client(**kwargs)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need a wrapper for the /embeddings endpoint too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add it in a new PR 🙏

@fantix fantix merged commit e38833f into master May 1, 2024
42 checks passed
@fantix fantix deleted the ai branch May 1, 2024 14:54
@fantix fantix changed the title Create edgedb_ai package Create edgedb.ai package May 1, 2024
fantix added a commit that referenced this pull request Jun 19, 2024
New Features
============

* Support EdgeDB 5.0 "branch" connection option
  (by @vpetrovykh in #484 #485 #487)

* Support EdgeDB 5.0 AI extension
  (by @fantix in #489 #490)

Breaking Changes
================

* Enum values can now compare to user-defined enums successfully (#425)
  (by @fantix in bb7522c for #419)

* Add optional default to codegen params (#426)
  (by @fantix in 21b024a for #422)

Changes
=======

* blocking client: fix connect and timeout, support IPv6 (#499)
  (by @fantix @zachary822 in 28a83fd for #486)

Fixes
=====

* Add test to check setting a computed global using with_globals. (#494)
  (by @dnwpark in 636bc0e for #494)

* Fix test and add Python 3.12 in CI
  (by @fantix in #498 #503)

* Use result of pydantic_dataclass, will silence linters (#501)
  (by @AdrienPensart in d88187a)

* Extract ExecuteContext as in/out argument (#500)
  (by @fantix in 2fb7965 for #493)
@fantix fantix mentioned this pull request Jun 19, 2024
fantix added a commit that referenced this pull request Jun 19, 2024
New Features
============

* Support EdgeDB 5.0 "branch" connection option
  (by @vpetrovykh in #484 #485 #487)

* Support EdgeDB 5.0 AI extension
  (by @fantix in #489 #490)

Breaking Changes
================

* Enum values can now compare to user-defined enums successfully (#425)
  (by @fantix in bb7522c for #419)

* Add optional default to codegen params (#426)
  (by @fantix in 21b024a for #422)

Changes
=======

* blocking client: fix connect and timeout, support IPv6 (#499)
  (by @fantix @zachary822 in 28a83fd for #486)

Fixes
=====

* Add test to check setting a computed global using with_globals. (#494)
  (by @dnwpark in 636bc0e for #494)

* Fix test and add Python 3.12 in CI
  (by @fantix in #498 #503)

* Use result of pydantic_dataclass, will silence linters (#501)
  (by @AdrienPensart in d88187a)

* Extract ExecuteContext as in/out argument (#500)
  (by @fantix in 2fb7965 for #493)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants