Skip to content

Commit

Permalink
Merge pull request #1 from whyhow-ai/release-0.0.3
Browse files Browse the repository at this point in the history
Release 0.0.3
  • Loading branch information
tomsmoker authored Apr 5, 2024
2 parents 959ae7a + e2766ce commit 52a3b11
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 21 deletions.
18 changes: 18 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# .env.example
# Copy this file as '.env' and fill in the values as described below.
WHYHOW_API_KEY=""

# OpenAI API Key: A string containing your OpenAI API key for accessing their services.
OPENAI_API_KEY=""

# Pinecone API Key: A string with your Pinecone API key.
PINECONE_API_KEY=""

# Neo4J URI: The URI for connecting to your Neo4J database instance.
NEO4J_URI=""

# Neo4J User: The username for Neo4J database authentication.
NEO4J_USERNAME=""

# Neo4J Password: The password for Neo4J database authentication.
NEO4J_PASSWORD=""
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Python Version](https://img.shields.io/badge/python-3.10%2B-blue)](https://www.python.org/downloads/)
[![License](https://img.shields.io/badge/license-MIT-green)](https://opensource.org/licenses/MIT)
[![PyPI Version](https://img.shields.io/pypi/v/whyhow)](https://pypi.org/project/why/)
[![PyPI Version](https://img.shields.io/pypi/v/whyhow)](https://pypi.org/project/whyhow/)
[![Code Style: Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Checked with mypy](https://img.shields.io/badge/mypy-checked-blue)](https://mypy-lang.org/)
[![Whyhow Discord](https://dcbadge.vercel.app/api/server/9bWqrsxgHr?compact=true&style=flat)](https://discord.gg/9bWqrsxgHr)
Expand Down
2 changes: 1 addition & 1 deletion src/whyhow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

from whyhow.client import AsyncWhyHow, WhyHow

__version__ = "v0.0.2"
__version__ = "v0.0.3"
__all__ = ["AsyncWhyHow", "WhyHow"]
6 changes: 1 addition & 5 deletions src/whyhow/apis/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,6 @@ def query_graph(self, namespace: str, query: str) -> QueryGraphReturn:

response = QueryGraphResponse.model_validate(raw_response.json())

retval = QueryGraphReturn(
answer=response.answer,
cypher_query=response.cypher_query,
context=response.context,
)
retval = QueryGraphReturn(answer=response.answer)

return retval
6 changes: 0 additions & 6 deletions src/whyhow/schemas/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,9 @@ class QueryGraphResponse(BaseResponse):

namespace: str
answer: str
# triples: list[Triple]
cypher_query: str
context: str


class QueryGraphReturn(BaseReturn):
"""Schema for the return value of the query graph endpoint."""

answer: str
# triples: list[Triple]
cypher_query: str
context: str
8 changes: 1 addition & 7 deletions tests/apis/test_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ def test_query_graph(self, httpx_mock):
fake_response_body = QueryGraphResponse(
namespace="something",
answer="Alice knows Bob",
cypher_query="MATCH (p:Person) {p.name: 'Alice'}-[:knows]->(p2:Person) RETURN p2",
context="Alice knows Bob",
)
httpx_mock.add_response(
method="POST",
Expand All @@ -53,11 +51,7 @@ def test_query_graph(self, httpx_mock):
query=query,
)

assert result == QueryGraphReturn(
answer="Alice knows Bob",
cypher_query="MATCH (p:Person) {p.name: 'Alice'}-[:knows]->(p2:Person) RETURN p2",
context="Alice knows Bob",
)
assert result == QueryGraphReturn(answer="Alice knows Bob")

actual_request = httpx_mock.get_requests()[0]
expected_request_body = QueryGraphRequest(query=query)
Expand Down
5 changes: 4 additions & 1 deletion tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ def test_httpx_kwargs(self, monkeypatch):
args, kwargs = fake_httpx_client_class.call_args

assert not args
assert kwargs["base_url"] == "https://43nq5c1b4c.execute-api.us-east-2.amazonaws.com"
assert (
kwargs["base_url"]
== "https://43nq5c1b4c.execute-api.us-east-2.amazonaws.com"
)
assert not kwargs["verify"]

assert client.httpx_client is fake_httpx_client_class.return_value
Expand Down

0 comments on commit 52a3b11

Please sign in to comment.